<font>
The HTML <font> element, which is now obsolete, was previously utilized to set the font size, color, and type for text. CSS is now recommended for more versatile and consistent text styling.
font Tag
The <font>
element, introduced in HTML 4, was historically used to define text's typeface, size, and color. However, it is now deprecated, and CSS is the standard method for text styling in modern web development.
Syntax
index.html
<font face="Arial" size="4" color="red">Text to style</font>
Examples
- Apply a text color using CSS:
This is a paragraph.
This is another paragraph.
index.html
<p style="color:red">This is a paragraph.</p>
<p style="color:blue">This is another paragraph.</p>
- Specify the font for text using CSS:
This is a paragraph.
This is another paragraph.
index.html
<p style="font-family:verdana">This is a paragraph.</p>
<p style="font-family:'Courier New'">This is another paragraph.</p>
- Adjust the text size using CSS:
This is a paragraph.
This is another paragraph.
index.html
<p style="font-size:30px">This is a paragraph.</p>
<p style="font-size:11px">This is another paragraph.</p>
Conclusion
The <font>
element, once used to specify text's typeface, size, and color, is now obsolete in modern HTML. CSS provides a more efficient and powerful way to style text, ensuring better flexibility, responsiveness, and maintainability. Adopting CSS for text styling aligns with current web development standards and enhances accessibility.