font-weight

Anonymous contributors
Anonymous contributors
Published Jun 30, 2021Updated Sep 3, 2021
Contribute to Docs

To set the text to be thicker or thinner.

Syntax

font-weight: <font-weight-value>;

The font-style-value can be the following:

  • normal
  • bolder
  • bold
  • initial
  • inherit
  • lighter

or can be in the form of numerical values from 100 to 900. The default value is normal while the default numerical value is 400.

Example 1

Set the p tag to bold:

p {
font-weight: bold;
}

Example 2

Set the p tag to 600:

p {
font-weight: 600;
}

All contributors

Looking to contribute?

Learn CSS on Codecademy