Skip to content
Tutorials Center
My learning

Topics

HTML Reference ยท Obsolete Elements

The <basefont> element (obsolete)

The HTML <basefont> element tried to set a page's default font size, color and face. Learn why it is obsolete and how to do the same with CSS on the body.

The <basefont> element was meant to set the default font for a whole document. Placed once, usually in the <head>, it took size (1 to 7, with 3 as the default), color and face attributes, and relative sizes in <font> tags were calculated from it.

Why it's obsolete

<basefont> was presentational markup, describing looks instead of meaning, and it was deprecated in HTML 4 and dropped in HTML5. It was also never reliable: only some older browsers, notably Internet Explorer, ever applied it, and others ignored it from the start.

Current browsers ignore it completely. The element produces no output and has no effect on the text around it.

Modern replacement

Set the page's default font on body (or :root) in CSS. Every element inherits it unless you override it.

HTML
<!-- Before: obsolete, ignored by browsers -->
<head>
  <basefont size="4" color="navy" face="Georgia">
</head>
After: page defaults with CSS

Technical summary

Status Obsolete (non-conforming)
Replacement CSS font-family, font-size and color on body
Still rendered by browsers No; it has no effect