在 CSS 中如何更改 h1 和 h2 的字体大小
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10668056/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
In CSS how do you change font size of h1 and h2
提问by Ahmed
In a word press twenty eleven theme. I want to change the size of headings When I wrap my headings around h1 and h2 tags as follows
总之按二十一个主题。我想更改标题的大小当我将标题围绕 h1 和 h2 标签时,如下所示
<h1>My h1 heading </h1>
<h2> My h2 heading </h2>
The font size of heading in the theme I am using is almost same as content's font except that they are bold. So my headings are not quite prominent.
我使用的主题中标题的字体大小与内容的字体几乎相同,只是它们是粗体。所以我的标题不是很突出。
I guess I would need to change something in the css file. Please advise what exactly in need to put in.
我想我需要更改 css 文件中的某些内容。请告知究竟需要放入什么。
Thanks,
谢谢,
回答by Bram Vanroy
h1 {
font-weight: bold;
color: #fff;
font-size: 32px;
}
h2 {
font-weight: bold;
color: #fff;
font-size: 24px;
}
Note that after color you can use a word (e.g. white
), a hex code (e.g. #fff
) or RGB (e.g. rgb(255,255,255)
) or RGBA (e.g. rgba(255,255,255,0.3)
).
请注意,在颜色之后,您可以使用单词(例如white
)、十六进制代码(例如#fff
)或 RGB(例如rgb(255,255,255)
)或 RGBA(例如rgba(255,255,255,0.3)
)。
回答by Jukka K. Korpela
h1 { font-size: 150%; }
h2 { font-size: 120%; }
Tune as needed.
根据需要调整。
回答by recursive
What have you tried? This should work.
你尝试过什么?这应该有效。
h1 { font-size: 20pt; }
h2 { font-size: 16pt; }