Skip to main content

HTML Tags

HTML <basefont> Tag

Written by Updated HTML <basefont> Tag exercises

The basefont tag once set a default font size, color and face for a whole page. It is obsolete, and current browsers ignore it completely: the text in the example simply appears in the normal default font.

It was meant to be placed once near the top of the page and change all the text. CSS on the body element does that job today, far more flexibly.

Syntax

html

<basefont size="value" color="color" face="font-name">
AttributeWhat it did
sizeThe base size, from 1 to 7, where 3 was normal.
colorThe default text color.
faceThe default font.

Example

html

<!DOCTYPE html>
<html>
<head>
  <title>Basefont Tag Example</title>
</head>
<body>

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

<h2>Basefont Tag Example</h2>
<p>This paragraph follows the base font settings.</p>
<p>All text inherits size, color, and font face.</p>

</body>
</html>

In a current browser, the heading and paragraphs appear in the normal default font, color and size. The <basefont> line has no effect at all.

Browser Support

Chrome
Edge
Firefox
Safari
Opera
NoNoNoNoNo

The modern way

css

body {
  font-family: Arial;
  font-size: 16px;
  color: blue;
}

Set the base font once on body, and every element inherits it unless you change it. Use font-size in rem or % rather than pixels, so the reader's own text size setting still works. Related obsolete tags are the font tag and the big tag.

HTML <basefont> Tag exercises

Set the page's type with CSS

The basefont element is gone. Write a paragraph that says Hello and a style block that gives the body a text size of 20px.

Result

Check your answer to see it here.