CSS font-weight
CSS font-weight 属性定义与用法
font-weight 属性设置文本的粗细
默认值: | normal |
---|---|
继承: | yes |
版本: | CSS1 |
JavaScript 语法: | object.style.fontWeight="900" |
CSS font-weight 属性值
值 | 描述 |
---|---|
normal | 默认值。定义标准的字符。 |
bold | 定义粗体字符。 |
bolder | 定义更粗的字符。 |
lighter | 定义更细的字符。 |
|
定义由粗到细的字符。400 等同于 normal,而 700 等同于 bold。 |
inherit | 规定应该从父元素继承字体的粗细。 |
CSS font-weight 浏览器支持
所有主流浏览器都支持font-weight属性。
注意:IE7和更早的版本不支持"inherit"的值。IE8需要定义!DOCTYPE。IE9支持"inherit"。"inherit".
CSS font-weight 实例
三段文字设置不同的字体粗细:
<!DOCTYPE html>
<html>
<head>
<style>
p.normal {font-weight:normal;}
p.light {font-weight:lighter;}
p.thick {font-weight:bold;}
p.thicker {font-weight:900;}
</style>
</head>
<body>
<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>
</body>
</html>
相关文章
CSS 教程: CSS Font
CSS 参考手册: font 属性