W3docs

HTML <basefont> Tag

The <basefont> tag specifies the default font size and color of the text. It can be used several times inside the <head> or <body> tags. See examples.

The <basefont> tag specifies the default font size and color of the text. It can be used several times inside the <head> or <body> tags.

Danger

The <basefont> is a deprecated HTML tag and not supported in HTML5.

Syntax

The <basefont> tag is empty, which means that the closing tag isn’t required. But in XHTML, the (<basefont>) tag must be closed (<basefont/>).

Example of the HTML <basefont> tag:

<!DOCTYPE html>
<html>
  <head>
    <title>Title of the documnet</title>
    <basefont color="green" face="Helvetica" size="14">
  </head>
  <body>
    <h3>Title of the text.</h3>
    <p>Paragraph of the text.</p>
  </body>
</html>
Tip

To achieve the former behavior of the <basefont> use CSS font, font-family, font-size and color properties.

Example of the HTML <basefont> tag with CSS properties:

<!DOCTYPE html>
<html>
  <head>
    <title>Title of the document</title>
    <style>
      body {
        color: #8ebf42; 
        font-size: 14px;
        font-family: Helvetica;
      }
    </style>
  </head>
  <body>
    <h3>Title of the text.</h3>
    <p>Paragraph of the text.</p>
  </body>
</html>

Result

basefont exemple

Attributes

AttributeValueDescription
colorcolorSets the default text color. Not supported in HTML5.
facefont_familyDefines the font of the text. Not supported in HTML5.
sizenumberSpecifies the font size. Not supported in HTML5.

Practice

Practice

What is true about the HTML <basefont> tag?