HTML Font Family – Learn to use font-family property with examples

HTML Font Family

The font-family property sets the font or font family for text. For example font styles like Verdana, Arial etc. You may prioritize font by adding a space between font names. The first font will be checked first, if this is not available in user’s browser next one will be applied and so on.

As such <font> tag is not supported in HTML 5. This example shows how to use font-family property in CSS to apply font name to different text tags (h1, h2 and div tags).

As you can see in font-family property you can specify font names just like in font face attribute of <font> tag. You can separate font names by spaces to set priority.

The last font name in the list should be one of five generic family names that are always available in HTML and CSS. The five generic font names are:

  1. Serif
  2. Sans-serif
  3. Cursive
  4. Fantasy
  5. Monospace

Also see HTML table | CSS font | HTML form | HTML Font

Was this article helpful?

Related Articles

Leave A Comment?