Categories
HTML

How to Specify the Font of a Text with CSS font-family Property

Serif fonts

Serif fonts have a small stroke at the end of their longer strokes.

Serif fonts examples:

  • Times New Roman
  • Times

How to specify Serif fonts

.serif-class {
  font-family: "Times New Roman", Times, serif;
}

Sans serif fonts

Sans serif fonts have clean lines without small strokes attached.

Sans serif fonts examples:

  • Arial
  • Helvetica

How to specify Sans serif fonts

.sans-serif-class {
  font-family: Arial, Helvetica, sans-serif;
}

Monospace fonts

A monospace font is a font in which all the letters have the same fixed width.

Monospace fonts examples:

  • Courier New
  • Courier

How to specify Monospace fonts

.monospace-class {
  font-family: 'Courier New', Courier, monospace;
}

Leave a Reply

Your email address will not be published. Required fields are marked *