CSS 如何从标题中删除粗体?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/8079070/
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
how to remove the bold from a headline?
提问by Asher Saban
I have a headline:
我有一个标题:
<h1>THIS IS A HEADLINE</h1>
How do i make the phrase "THIS IS..." not to be bold and the rest without a change? couldn't find any relevent tag in text-decoration.
我如何使“这是……”这句话不加粗,其余不变?在文本装饰中找不到任何相关标签。
回答by Sarfraz
The heading looks bold because of its large size, if you have applied bold or want to change behaviour, you can do:
标题看起来很粗,因为它的尺寸很大,如果你应用了粗体或想要改变行为,你可以这样做:
h1 { font-weight:normal; }
回答by Ya Zhuang
Try font-weight:normal;
尝试 font-weight:normal;
h1 {
font-weight: normal;
}
回答by matzino
<h1><span style="font-weight:bold;">THIS IS</span> A HEADLINE</h1>
But be sure that h1 is marked with
但请确保 h1 标有
font-weight:normal;
You can also set the style with a id or class attribute.
您还可以使用 id 或 class 属性设置样式。
回答by Quentin
You want font-weight, not text-decoration (along with suitable additional markup, such as <em>
or <span>
, so you can apply different styling to different parts of the heading)
您需要font-weight,而不是 text-decoration (以及合适的附加标记,例如<em>
or <span>
,以便您可以对标题的不同部分应用不同的样式)
回答by Graeme Leighfield
style is accordingly vis css. An example
样式因此是 vis css。一个例子
<h1 class="mynotsoboldtitle">Im not bold</h1>
<style>
.mynotsoboldtitle { font-weight:normal; }
</style>
回答by Matt Fletcher
<h1><span>This is</span> a Headline</h1>
h1 { font-weight: normal; text-transform: uppercase; }
h1 span { font-weight: bold; }
I'm not sure if it was just for the sake of showing us, but as a side note, you should always set uppercase text with CSS :)
我不确定这是否只是为了向我们展示,但作为旁注,您应该始终使用 CSS 设置大写文本 :)
回答by radiant
for "THIS IS" not to be bold -
add <span></span>
around the text
对于“这是”不要加粗 -<span></span>
在文本周围添加
<h1>><span>THIS IS</span> A HEADLINE</h1>
and in style
和风格
h1 span{font-weight:normal}
回答by magic smile
you can simply do like that in the html part:
你可以简单地在 html 部分这样做:
<span>Heading Text</span>
and in the css you can make it as an h1 block using display:
在 css 中,您可以使用 display 将其设置为 h1 块:
span{
display:block;
font-size:20px;
}
you will get it as a h1 without bold ,
if you want it bold just add this to the css:
你会得到一个没有粗体的 h1 ,
如果你想要粗体,只需将它添加到 css 中:
font-weight:bold;
回答by yusef
You can use font-weight:100
or lighter: this is working with i.e. Opera 16 and older, but I do not know why the h1
tags in Firefox are bolder, sorry.
您可以使用font-weight:100
或更轻:这适用于 ie Opera 16 及更早版本,但我不知道为什么h1
Firefox 中的标签更粗,抱歉。