Skip to content
Tutorials Center
My learning

Topics

HTML Reference ยท Obsolete Elements

The <font> element (obsolete)

The HTML <font> element set text color, size and typeface and is obsolete. See how browsers still render it and how to replace it with CSS classes.

The <font> element changed the look of the text inside it with three attributes: color (a color name or hex value), size (1 to 7, or a relative value such as +1) and face (a comma-separated list of font names).

Why it's obsolete

<font> was the symbol of 1990s web design: styling poured directly into the markup, repeated on every page. Changing a site's colors meant editing hundreds of tags, and the tags told screen readers and search engines nothing. CSS replaced it, HTML 4 deprecated it, and HTML5 made it obsolete.

Browsers still render all three attributes, so old pages look as they always did.

Modern replacement

Move the styling into CSS. A class describes the purpose of the text and can be changed in one place.

font before, CSS after

If the styled text also means something, such as a warning, combine CSS with a meaningful element like <strong>.

Technical summary

Status Obsolete (non-conforming)
Replacement CSS color, font-size and font-family
Still rendered by browsers Yes, including the color, size and face attributes