Typography

CSS Font Weight

Controlling Font Weight

CSS font weight sets normal, bold, or numeric values like 700.

Overview of CSS Font Weight

CSS font-weight property allows you to control the thickness of the text. It is a crucial aspect of typography that affects the readability and visual appeal of your web pages. By adjusting the font weight, you can make text stand out or blend in, depending on your design requirements.

Common Font Weight Values

The font-weight property accepts several predefined values that adjust the thickness of the font:

  • normal: The default font weight. Typically equivalent to 400.
  • bold: A heavier font weight. Typically equivalent to 700.
  • bolder: Bolder than the inherited font weight.
  • lighter: Lighter than the inherited font weight.

Numeric Font Weight Values

In addition to the keyword values, font-weight can be specified using numeric values ranging from 100 to 900 in increments of 100. These numeric values provide a fine-grained control over font weight, allowing you to specify exactly how thick or thin you want your text to appear.

Using Font Weight in Responsive Design

Font weight can be adjusted for different screen sizes to enhance readability and aesthetics. For example, you might want to use a bolder font on smaller screens to improve text visibility.

Conclusion

Mastering the use of font-weight in CSS is essential for creating visually appealing and readable text. By understanding both keyword and numeric values, you can tailor the text appearance to fit your design needs perfectly.

Previous
Font Size