Home » CSS Font

CSS Font

CSS Font property is used to control the look of texts. By the use of CSS font property you can change the text size, color, style and more. You have already studied how to make text bold or underlined. Here, you will also know how to resize your font using percentage.

These are some important font attributes:

  1. CSS Font color: This property is used to change the color of the text. (standalone attribute)
  2. CSS Font family: This property is used to change the face of the font.
  3. CSS Font size: This property is used to increase or decrease the size of the font.
  4. CSS Font style: This property is used to make the font bold, italic or oblique.
  5. CSS Font variant: This property creates a small-caps effect.
  6. CSS Font weight: This property is used to increase or decrease the boldness and lightness of the font.

1) CSS Font Color

CSS font color is a standalone attribute in CSS although it seems that it is a part of CSS fonts. It is used to change the color of the text.

There are three different formats to define a color:

  • By a color name
  • By hexadecimal value
  • By RGB

In the above example, we have defined all these formats.

Test it Now

Output:

This is heading 1

This is heading 2

This is a paragraph.

You may also like