为三个段落设置不同的字体粗细:
p.normal {
font-weight: normal;
}
p.thick {
font-weight: bold;
}
p.thicker {
font-weight: 900;
}
亲自试一试 »
这个font-weight
属性设置文本中字符的显示方式。
表中的数字指定完全支持该属性的第一个浏览器版本。
Property | |||||
---|---|---|---|---|---|
font-weight | 2.0 | 4.0 | 1.0 | 1.3 | 3.5 |
font-weight: normal|bold|bolder|lighter|
number|initial|inherit;
Value | Description | Demo |
---|---|---|
normal | Defines normal characters. This is default | Demo ❯ |
bold | Defines thick characters | Demo ❯ |
bolder | Defines thicker characters | Demo ❯ |
lighter | Defines lighter characters | Demo ❯ |
100 200 300 400 500 600 700 800 900 |
Defines from thin to thick characters. 400 is the same as normal, and 700 is the same as bold | Demo ❯ |
initial | Sets this property to its default value. Read about initial | |
inherit | Inherits this property from its parent element. Read about inherit |
CSS教程:CSS 字体
CSS 参考:字体属性
HTML DOM 参考:fontWeight 属性
截取页面反馈部分,让我们更快修复内容!也可以直接跳过填写反馈内容!