如何定位特定div ID的标题? [英] How to target headings for a specific div ID?

查看:228
本文介绍了如何定位特定div ID的标题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试使用不同的字体系列来标记我的标题中的所有标题,而不是页面其余部分的标题,但我无法获得该样式,只适用于特定的标头ID。

这是我试过的:

  #header h1,h2,h3,h4 {
font-family:'Helvetica';
}

但这会导致所有h1 / 2/3/4标签使用Helvetica字体,无论他们是否在头div中。我相信我错过了一些简单的,任何人都可以帮助?谢谢!

解决方案

我认为你必须这样做:

  #header h1,#header h2,#header h3,#header h4 {
font-family:'Helvetica';
}


I am trying to style all the headings in my header with a different font-family than the headings on the rest of the page but I am having trouble getting the style to only apply to the specific header ID.

Here is what I tried:

#header h1,h2,h3,h4 {
    font-family:'Helvetica';
}

But this causes all h1/2/3/4 tags to use the Helvetica font regardless of if they are in the header div or not. I'm sure I am missing something simple, can anyone help? Thanks!

解决方案

I think you must do so:

#header h1,#header h2, #header h3, #header h4 {
    font-family:'Helvetica';
}

这篇关于如何定位特定div ID的标题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆