Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

HTML DOM Style fontWeight Property

Style fontWeight Property

Style Object Reference 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

Internet ExplorerFirefoxOperaGoogle ChromeSafari

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:

Runoob Tutorial(runoob.com)

This is some text.


Try it »


Style Object Reference The Style object