font-weight

font-weight 属性规定文本的粗细。

 

语法

p {font-weight:normal;}
p {font-weight:bold;}
p {font-weight:900;}

描述
normal默认值。定义标准的字符。
bold定义粗体字符。
bolder定义更粗的字符。
lighter定义更细的字符。
100-900定义由粗到细的字符。400 等同于 normal,而 700 等同于 bold。
inherit规定应该从父元素继承字体的粗细。

例子

HTML

<p class="normal">This is a paragraph.</p>
<p class="light">This is a paragraph.</p>
<p class="thick">This is a paragraph.</p>
<p class="thicker">This is a paragraph.</p>

CSS

p.normal {font-weight:normal;}
p.light {font-weight:lighter;}
p.thick {font-weight:bold;}
p.thicker {font-weight:900;}

执行结果

This is a paragraph.

This is a paragraph.

This is a paragraph.

This is a paragraph.

参考

相关链接

外部链接