The
<font>tag was historically used to change the font face, size, and color of text in HTML.
It is deprecated in HTML5, and modern web design uses CSS (font-family,font-size,color) instead.
Syntax
<font face="fontName" size="value" color="colorValue">Text</font>Attributes
| Attribute | Description |
|---|---|
| face | Specifies the font family of the text. |
| size | Specifies the font size (1–7 or relative values). |
| color | Specifies the text color. |
Example
<!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>Output
Browser Output
The text inside the <font> tag is displayed using the specified font face, size, and color.
Please use our TryIt Editor to see the effect.
Browser Support
Chrome | Firefox | Edge | Safari | Opera | IE9+ |
|---|---|---|---|---|---|
| ✅Yes | ✅Yes | ✅Yes | ✅Yes | ✅Yes | ✅Yes |
All major browsers support <font> tag.
Notes
- The
<font>tag is obsolete and should not be used in modern HTML. - CSS properties provide a more flexible and standardized approach for text styling.
- Deprecated tags like
<font>may still work in modern browsers for backward compatibility, but using them is not recommended.
Conclusion
The <font> tag was once used to style text directly in HTML, but it is deprecated.
For maintainable and modern web design, always use CSS for text styling.