English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
font-The weight CSS attribute sets the thickness of the font.
The following table provides usage instructions and version history of this attribute, as well as the syntax of using this attribute in JavaScript scripts.
Default value: | Normal |
---|---|
Applicable to: | All elements |
Inheritance: | Yes |
Can be animated: | Yes.Please refer to Animation properties. |
Version: | CSS 1,2,3 |
JavaScript syntax: | object.style.fontWeight="700" |
The syntax of this attribute is as follows:
font-weight: normal | bold | bolder | lighter | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900 | initial | inherit
The following examples demonstrate how to use font-weight attribute.
h1 { font-weight: normal; } p { font-weight: bold; }Test see‹/›
The following table describes the value of this attribute.
Value | Description |
---|---|
normal | Specify normal characters. |
bold | Specify bold characters. |
bolder | Define thicker characters. |
lighter | Select a finer character definition. |
100 | numeric100 to900 to form an ordered sequence, where each number represents a weight value that is equal to or greater than the previous value. The keyword normal equals400, bold equals700. |
200 | |
300 | |
400 | |
500 | |
600 | |
700 | |
800 | |
900 | |
initial | Set this attribute to its default value. |
inherit | If specified, the associated element adopts its parent element's font-The value of the weight attribute. |
font-Browser compatibility of the weight attribute; the numbers in the table below represent the minimum version number of the browser that supports this attribute; all mainstream browsers support this attribute.
|
Please refer to the following tutorials:CSS font,CSS text.
Related attributes and rules:font,font-style,font-variant,font-size,line-height,font-family,@font-face.