HTML basefont tag

HTML <basefont> tag: The basefont tag describes the default text-color, font-size for the entire text in the document. It is not supported in HTML5. This tag can be used in both <head> and <body> element.

 HTML <basefont> tag

It was supported by the elements like <color>, <face> and <size>

Syntax: <basefont color=” ” size=” “>

Optional Attributes: The HTML basefont tag contains three optional attributes which are listed below:

  • color: It is used to specify the default text-color of document.
  • size: It is used to specify the default font-size of document.
  • face: It is used to specify the default font-style of document.

Browser compatibility

The <basefont> tag is InternetExplorer9 and other new versions.

Example:

<!DOCTYPE html>
<html>
<head>
<basefont color="red" size="5">
</head>

<body>
<h1>This is a heading</h1>
<p>This is a paragraph.</p>

<p>The basefont element is not supported in HTML5. Use CSS instead.</p>

</body>
</html>

Output:

This is a heading

This is a paragraph.

The basefont element is not supported in HTML5. Use CSS instead.

Attributes supported by the <basefont> tag

Attribute Value Description
color color Specifies the default color for text in a document
face font_family Specifies the default font for text in a document
size number Specifies the default size of the text in a document