- Home
- /
- Tutorials
- /
- HTML Tutorial
- /
- HTML <basefont> Tag
HTML Tags
HTML <basefont> Tag
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">| Attribute | What it did |
|---|---|
| size | The base size, from 1 to 7, where 3 was normal. |
| color | The default text color. |
| face | The 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 |
|---|---|---|---|---|
| No | No | No | No | No |
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
