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.

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>
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

Attribute Value Description
color color Sets the default text color.
Not supported in HTML5.
face font_family Defines the font of the text.
Not supported in HTML5.
size number Specifies the font size.
Not supported in HTML5.

Browser support

chrome edge firefox safari opera

Practice Your Knowledge

What is true about the HTML <basefont> tag?

Quiz Time: Test Your Skills!

Ready to challenge what you've learned? Dive into our interactive quizzes for a deeper understanding and a fun way to reinforce your knowledge.

Do you find this helpful?