HTML - basefont Tag

HTML basefont Tag

What Are <font> and <basefont> Tags?

<font> tag

Back in the early days of HTML, the <font> tag was used to directly style text — you could set the font type, size, and color right in the HTML. The downside? You had to add it every time you wanted styled text.

Example:

<font face="Arial" size="4" color="blue">
This is blue Arial text, size 4.
</font>

<basefont> tag

This tag was like a “global font setting” for your page. Once you set it, all the text on the page would use that font, size, and color — unless a <font> tag overrode it.

<font face="Arial" size="4" color="blue" >
This is blue Arial text, size 4.
</font>

Why Are They Deprecated?

  1. Both &l;font> and &l;basefont> are outdated because:
  2. The &l;basefont> tag is deprecated in HTML 4 and completely removed from HTML 5. Instead of using this tag, we can use the CSS properties to style the document.
  3. They’re hard to maintain (you’d need to edit multiple places to change a style).
  4. They mix design with content, making code messy.
  5. They aren’t responsive for mobile and modern devices.
  6. CSS came along, making them unnecessary.
<!DOCTYPE html> <html> <head> <title>HTML basefont Example</title> </head> <body> <basefont face="Arial, Helvetica" color="blue" size="5"> <p>This text is styled using the <code>&lt;basefont&gt;</code> tag.</p> <p>It sets the default font face, size, and color for the entire page.</p> <p><b>Note:</b> The <code>&lt;basefont&gt;</code> tag is deprecated and should be replaced with CSS.</p> </body> </html>
Previous Post Next Post