Tag font

The font tag was originally used in HTML to change the font, size, and color of text. It was popular in early web development, but it has been deprecated in HTML5 because it mixes content with styling, which goes against modern web standards.

✅ Modern practice: Use CSS instead.


✅ Old Syntax (Not Recommended Today)

<font face="Arial" size="4" color="blue">Hello, world!</font>

📍 What it does (in legacy browsers):

  • face="Arial" — sets the font family
  • size="4" — sets the font size (from 1 to 7)
  • color="blue" — sets the text color

❌ Why It’s Deprecated

ProblemModern Solution (CSS)
Inline, hard-to-maintainUse external or internal CSS styles
No separation of concernsKeep HTML for structure, CSS for style
Limited flexibilityCSS gives far more styling options

✅ Modern CSS Equivalent

Instead of <font>, use a <span> or any semantic tag and style it with CSS:

<span style="font-family: Arial; font-size: 16px; color: blue;">
Hello, world!
</span>

Or, using a CSS class:

<style>
.custom-text {
font-family: Arial;
font-size: 16px;
color: blue;
}
</style>

<p class="custom-text">Hello, world!</p>

🧠 Summary

Feature<font> Tag
PurposeChange font, size, and color (outdated)
Supported?Yes in old browsers, but deprecated
Use in HTML5❌ No
Modern Approach✅ CSS

📝 Conclusion

While the <font> tag might still render in older browsers, it should no longer be used in any modern HTML project. Use CSS for all text styling to ensure your code is clean, responsive, and future-proof.