Style fontWeight Property
The Style object
Definition and Usage
The fontWeight property sets or returns the weight (boldness) of the font.
Syntax
Sets the fontWeight property:
Object.style.fontWeight="
value
"
Returns the fontWeight property:
Object.style.fontWeight
| Value | Description |
|---|---|
| normal | Default. The font is normal (normal). |
| lighter | Defines a lighter font. |
| bold | Defines bold. |
| bolder | Defines a bolder font. |
| 100 |
200
300
400
500
600
700
800
900 | 定义由细到粗的字符。400 等同于 normal,700 等同于 bold。 |
| inherit | The fontWeight property value is inherited from the parent element. |
Browser support





All major browsers support the fontWeight property.
**Note:** IE7 and earlier versions do not support the "inherit" value. IE8 supports "inherit" only if a !DOCTYPE is specified. IE9 supports "inherit".
Example
Example
Changes the font weight:
This is some text.
Try it »
The Style object