HTML <basefont> tag

Use of <basefont> tag

The <basefont> tag defines default font-color, font-family and font-size in a web-page or a document. This tag is not supported in HTML5.
Type: Empty tag

Example of <basefont> tag

<basefont color = "blue" size = "6" face = "Arial">

If you set as above within <head> element, all the texts will be red in color, font-size will be 6 (1-7 is defined) and font-family will be Arial for the whole document in the page.

Characteristics of <basefont> tag

1. The <basefont> tag is null or zero tag because it has no end tag or close tag like </basefont> tag.
2. The <basefont> tag should be defined within the head element like

<head>
    <basefont color = "blue" size = "6" face = "Arial">
</head>

3. It is optional meta-tag element. i.e. it can add or not, which depends on the author.
4. The maximum <basefont> tag that be can defined within a document is only one. i.e. it cannot have more than one like

<head>
    <basefont color = "blue" size = "6" face = "Arial">
    <basefont color = "red" size = "5" face = "Verdana">
</head>

5. Inorder to define <basefont> tag, you should use either at least one attribute between color, face and size attribute or you can use all of them.
The following example is invalid.

<head>
    <basefont>
</head>

Supported Browsers

Tag Chrome browser Internet explorer browser Firefox browser Safari browser Opera browser
<basefont> not supported not supported not supported not supported not supported

Full Code Examples

<!DOCTYPE html>
<html>
<head>
<basefont color = "blue" size = "4" face = "Arial">
</head>
<body>
<p> The texts within this paragraph will be blue color having 4 size with Arial font-family. </p>
</body>
</html>

Output

The texts within this paragraph will be blue color having 4 size with Arial font-family.

Attributes of <basefont> tag

Attributes Notes
color It defines the default text-color in a document.
size It defines the default font-size in a document.
face It defines the default font-family in a document.

All the above three attributes are not supported in HTML5. Their uses can be replaced with the help of CSS.

HTML color attribute can be replaced by CSS color property.
HTML size attribute can be replaced by CSS font-size property.
HTML face attribute can be replaced by CSS font-family property.