XML technologies / CSS / Advanced websites with CSS / CSS property reference / font-weight

(Excerpt from “CSS − Advanced websites with Cascading Stylesheets” by Rachel Andrew & Dan Shafer)

The property font-weight describes the stroke weight of the font in a text element.

Inherited: yes (For relative measurements, the parent element’s computed value is inherited.)

See also: font

Values

The CSS specification provides the following absolute values for font-weight:

  • normal (equivalent to 400)

  • bold (equivalent to 700)

  • 100

  • 200

  • 300

  • 400

  • 500

  • 600

  • 700

  • 800

  • 900

The following relative constants are also valid:

  • bolder

  • lighter

The starting value for bolder and lighter is the value applying to the parent element.

Default value: normal

Compatibility

CSS version: 1

Works in all CSS-capable browsers.

Most browsers support only the variants normal and bold and replace all other numeric and relative values with one of these variants.

Example

The following rule overrides most browsers’ default stylesheet behaviour, which displays strong elements with the value bold. In browsers supporting several font weights, the elements are displayed with a heavier weight than their parent elements’ text. A strong element inside a heading is therefore displayed with an even heavier weight:

strong {
 font-weight: bolder;
}

  

 

 

 

back to top