fontWeight 属性设置或返回文本中字符的显示粗细程度。
Property | |||||
---|---|---|---|---|---|
fontWeight | Yes | Yes | Yes | Yes | Yes |
返回 fontWeight 属性:
object.style.fontWeight
设置 fontWeight 属性:
object.style.fontWeight = "normal|lighter|bold|bolder|
value|initial|inherit"
Value | Description |
---|---|
normal | Font is normal. This is default |
lighter | Font is lighter |
bold | Font is bold |
bolder | Font is bolder |
100 200 300 400 500 600 700 800 900 |
Defines from light to bold characters. 400 is the same as normal, and 700 is the same as bold |
initial | Sets this property to its default value. Read about initial |
inherit | Inherits this property from its parent element. Read about inherit |
默认值: | 普通的 |
---|---|
返回值: | 一个字符串,代表字体的粗细 |
CSS版本 | CSS1 |
可能值的演示:
var listValue = selectTag.options[selectTag.selectedIndex].text;
document.getElementById("demo").style.fontWeight = listValue;
亲自试一试 »
CSS教程:CSS 字体
CSS 参考:字体粗细属性
HTML DOM 参考:字体属性
截取页面反馈部分,让我们更快修复内容!也可以直接跳过填写反馈内容!