8.5. CSS font-weight 属性
font-weight属性是CSS2.1提出的.IE6,Firefox1.5,Opera9支持此属性font-weight -- 定义字体的粗细
- 取值: normal | bold | bolder | lighter | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900 | inherit
- normal:正常,等同于 400
- bold:粗体,等同于 700
- bolder:更粗
- lighter:更细
- 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900:字体粗细的值
- inherit:继承
- 初始值: normal
- 继承性: 是
- 适用于: 所有元素
- font:字体.weight:重量,分量.
- 引用网址:http://www.dreamdu.com/css/property_font_weight/
示例
p#normal{font-weight:normal;}p#bold{font-weight:bold;}p#100{font-weight:100;}p#900{font-weight:900;}
说明:
- HTML的b标签定义了粗体显示的字体,此标签已经被w3c抛弃.
- XHTML的strong标签,在多数浏览器中也是显示了粗体,这是没有必要的,因为strong标签本身是强调的意思.
- 真正符合标准网页设计的显示粗体文字的方法是使用font-weight:bold; CSS属性.
- 使用100-900的数值表示粗体的时候通常情况下不会表现出什么不同.