CSS font-weight

View Output Full Screen Preview

The CSS font-weight property is used for specifying the weight of the font. You can specify a font as being bold, or another relevant value.

Although the font-weight property is typically used for specifying bold text, it can also be used for specifying a particular weight of a font face. Many typefaces come in a range of weights. You can specify that the body text is displayed in a light typeface, such as 300, and article ledes are displayed in say, 500. This assumes that such weights are available for the particular font face being used.

When a weight is specified for which no face exists, a face with a nearby weight is used. In general, bold weights map to faces with heavier weights and light weights map to faces with lighter weights.

If a bold font has been specified for which there is no bold face, the user agent will usually synthesize the effect. This can be disabled with the font-synthesis property.

Tip: Use font to set the most common font properties in one go.

Syntax

Possible Values

normal
Same as 400.
bold
Same as 700.
bolder
Specifies a bolder weight than the inherited value.
lighter
Specifies a lighter weight than the inherited value.
<number>

A specific numeric value between 1 and 1000. In older versions of CSS, this was restricted to strict increments of 100 (100, 200, 300, etc.), but modern CSS (with the introduction of Variable Fonts) allows any number. General mappings are often considered as:

  • 100: Thin.
  • 200: Extra Light (Ultra Light).
  • 300: Light.
  • 400: Normal.
  • 500: Medium.
  • 600: Semi Bold (Demi Bold).
  • 700: Bold.
  • 800: Extra Bold (Ultra Bold).
  • 900: Black (Heavy).

In addition, all CSS properties also accept the following CSS-wide keyword values as the sole component of their property value:

initial
Represents the value specified as the property's initial value.
inherit
Represents the computed value of the property on the element's parent.
unset
This value acts as either inherit or initial, depending on whether the property is inherited or not. In other words, it sets all properties to their parent value if they are inheritable or to their initial value if not inheritable.

General Information

Initial Value
normal
Applies To
All elements
Inherited?
Yes
Media
Visual
Animatable
Yes, as a font weight (number) (see example)

Example Code

Official Specifications

Browser Support

Browser support for CSS properties can vary, particularly for newer or experimental features. Check current browser compatibility before using a property in production, especially when supporting older browsers.

Initial Value

CSS properties have an initial value that applies when the property has not been explicitly set. The initial value is different from the value inherited from a parent element and may vary between properties.

Inheritance

Some CSS properties inherit their computed value from their parent element by default, while others do not. The inherit, initial, unset, and revert keywords can also be used to control how a property gets its value.

Vendor Prefixes

Most modern CSS properties use the standard, unprefixed syntax. Vendor-prefixed properties such as -webkit- are mainly relevant to older browser versions or specific features and should only be used when required by your browser support targets.