Deprecated in HTML5. Do not use.

<basefont size=""> HTML Attribute

Disclosure: Your support helps keep the site running! We earn a referral fee for some of the services we recommend on this page. Learn more
Attribute of
<basefont> HTML Tag
What does <basefont size=""> HTML Attribute do?
Was used to set the base font size for a whole document. Deprecated. Use CSS instead.

The right way to set a base font size

Use CSS for all font and typographical styling. The font-size property allows you to set the size of the display font, and there are several different units of measurement (em, px, %, vh) to choose from. Generally speaking (and there are a lot of exceptions) the most common best practice is to set the font-size on the body using px (CSS pixels), and then set all the other elements to em, which will be relative to the body size (1em = 100% of the inherited size).

body {
 font-size: 16px;
}

h1, h2, h3, h4, h5, h6 {
 font-weight: bold;
}

h1 {
 font-size: 2em;
}

h2 {
 font-size: 1.75em;
}

h3 {
 font-size: 1.60em;

h4{
 font-size: 1.50em;
}

h5 {
 font-size: 1.40em;
}

h6 {
 font-size: 1.25em;
}

.main-nav, footer {
 font-size: 0.8em;
}

.fine-print {
 font-size: 0.6em;
}

If you use relative font sizing, then all the different font sizes in your document will scale up or down together when the main size is adjusted.

Adam is a technical writer who specializes in developer documentation and tutorials.