English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

CSS Reference Manual

CSS @rules (RULES)

Complete list of CSS attributes

CSS font-Usage and examples of weight attribute

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"

font-The syntax of weight

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‹/›

Attribute value

The following table describes the value of this attribute.

ValueDescription
normalSpecify normal characters.
boldSpecify bold characters.
bolderDefine thicker characters.
lighterSelect 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
initialSet this attribute to its default value.
inheritIf specified, the associated element adopts its parent element's font-The value of the weight attribute.

Browser compatibility

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.

  • Firefox 1+

  • Google Chrome1+

  • Internet Explorer 3+

  • Apple Safari 1+

  • Opera 3.5+

Further reading

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.