HTML <basefont> Tag

The <basefont> element was used to define font-size, text-color or font family for all the texts in the document.

The <basefont> element should be inside the <head> element.

Note: The <basefont> tag is not in use anymore after HTML5.

Syntax

The <basefont> tag is an empty tag, which means that it has no end tag in HTML.

However, in XHTML the <basefont> element must be properly closed with <basefont />.

Example

<!DOCTYPE html>
<html>
  <head>
    <basefont color="green" face="Helvetica" size="14">
  </head>
  <body>
    <h3>We must place a heading here.</h3>
    <p>This is where we add a paragraph.</p>
  </body>
</html>

Recommendation: Use CSS color property instead of color attribute, CSS font-family property or CSS font-face property instead of face attribute and CSS font-size property instead of size attribute.

Example

<!DOCTYPE html>
<html>
  <head>
    <style>
      body{color:green;font-size:14px;font-family:Helvetica;}
    </style>
  </head>
  <body>
    <h3>We must place a heading here.</h3>
    <p>This is where we add a paragraph.</p>
  </body>
</html>

Attributes:

Attributes Value Description
color color Defines the default color of the text in a document.
It is not in use anymore after HTML5.
face font_family Defines the default font of the text in a document.
It is not in use anymore after HTML5.
size number Defines the default size of the text in a document.
It is not in use anymore after HTML5.

The <basefont> tag also supports the Global Attributes.