- Home
- /
- Tutorials
- /
- HTML Tutorial
- /
- HTML <font> Tag
HTML Tags
HTML <font> Tag
In the 1990s, the font tag was how you changed text: face for the font, size for the size, color for the color. Browsers still understand it, but HTML5 dropped it. CSS does all three, better.
What the font tag did
Syntax
html
<font face="fontName" size="value" color="colorValue">Text</font>| Attribute | What it did | CSS today |
|---|---|---|
| face | The font name, like face="Arial" | font-family |
| size | A size from 1 to 7, where 3 was normal | font-size |
| color | The text color, like color="red" | color |
The 1 to 7 scale was the real problem: you could not ask for an exact size, and every font change had to be repeated on every piece of text.
Example
html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Font Tag Example</title>
</head>
<body>
<h2>Deprecated <font> Tag Example</h2>
<p>
<font face="Arial" size="4" color="blue">
This text is Arial, size 4, and blue using the deprecated <font> tag.
</font>
</p>
<p>Modern alternative: use CSS <code>font-family</code>, <code>font-size</code>, and <code>color</code>.</p>
</body>
</html>The text appears in the font, size and color written in the tag. It still works because browsers keep old pages readable, not because the tag is still part of HTML.
The modern way
The same styling, written once in CSS, applies to every element you want:
Instead of font, use CSS
html
<style>
.note {
font-family: Arial, sans-serif;
font-size: 1.25rem;
color: #c0392b;
}
</style>
<p class="note">This text is styled with CSS.</p>Change the color in the stylesheet and every .note on the site updates. With <font>, you would have to edit each tag by hand. Learn more in CSS Font Family, CSS Font Size and CSS Text Color.
Browser Support
Chrome | Edge | Firefox | Safari | Opera | IE9+ |
|---|---|---|---|---|---|
| Yes | Yes | Yes | Yes | Yes | Yes |
Still displayed by every browser for old pages. Do not use it in new ones.
HTML <font> Tag exercises
Colour with CSS
Write a paragraph that says Hot with the class warm, and a style block that makes that class red.
Result
