What is the font-weight property in CSS?

Share

The font-weight property is meant for setting the weight (boldness) of the font. The default font-weight is set as normal. Other values that can be used for font-weight are:

  • bold: makes the text bold by setting its font-weight value to 400400.
  • Numerical values in the range of 100900100-900: These values represent the amount of weight we intend to assign to the text, where 900900 is the maximum weight.
  • bolder/lighter: makes the font-weight one weight bolder or lighter than its current value.
svg viewer

Implementation

The following code sets different a font-weight for each line of the text:

Copyright ©2024 Educative, Inc. All rights reserved