CSS FONTS

CSS provides several properties to control the font style and appearance of text.

1.font-family

Sets the typeface:

p {
  font-family: Arial, sans-serif;
}

2.font-size

Sets the size of the text:

p {
  font-size: 20px;
}

3.font-weight

Controls how bold the text is:

p {
  font-weight: bold;
}

Or:

p {
  font-weight: 700;
}

4.font-style

Makes text normal, italic, etc.:

p {
  font-style: italic;
}

5.font-variant

Controls font variations:

p {
  font-variant: small-caps;
 }

6.shorthan font

You can combine several font properties:

p {
  font: italic bold 20px Arial, sans-serif;
}

Common example

<h1>CSS Fonts</h1>
<p>This is a paragraph.</p>
h1 {
  font-family: Georgia, serif;
  font-size: 40px;
  font-weight: bold;
  font-style: italic;
}

p {
  font-family: Arial, sans-serif;
  font-size: 18px;
}

Main CSS font properties: font-family, font-size, font-weight, font-style, font-variant, and font.

Comments