👀 Live Preview
Modern equivalent using CSS on body (what you should use today):
This text uses CSS defaults: Georgia serif, slightly larger size, green color.

By the end of this tutorial, you’ll understand legacy basefont markup and the CSS approach used in modern web development.
How <basefont> set default size, color, and face for a page.
Understand the legacy size, color, and face attributes.
Why HTML5 removed <basefont> from the specification.
Set font-size, color, and font-family on body.
Replace legacy basefont tags found in old HTML with stylesheet rules.
Use external CSS and rem units for accessible, maintainable fonts.
<basefont> Tag?The basefont element (<basefont>) was a void tag placed in the document body that established default font properties for all subsequent text. Before widespread CSS adoption, it offered a quick way to set page-wide typography.
The <basefont> element is obsolete in HTML5. Modern browsers ignore it. Always use CSS to set default typography on body or via a stylesheet.
body {
font-size: 16px;
color: #334155;
font-family: system-ui, Arial, sans-serif;
}Legacy HTML combined all three attributes on one <basefont> tag:
<basefont size="3" color="blue" face="Arial, sans-serif">size used a 1–7 scale (3 was default) → CSS font-sizecolor accepted color names or hex values → CSS colorface listed font families with fallbacks → CSS font-family| Attribute | Legacy Values | CSS Replacement |
|---|---|---|
size | 1 – 7 (3 default) | font-size with px, rem, or em |
color | Color name or hex | color |
face | Comma-separated font list | font-family |
| Status | Deprecated / obsolete | Not supported in modern browsers |
| Modern approach | body { } rule | Set all defaults in one CSS rule |
| Related tag | <font> | Also deprecated; styled inline text |
<basefont> vs CSSCSS replaced basefont entirely. Here is how the two approaches compare:
| Approach | Status | Notes |
|---|---|---|
<basefont> | Deprecated | Limited to size/color/face; no media queries |
CSS body | Modern standard | Full typography control, responsive, maintainable |
| Separation of concerns | Best practice | HTML for structure; CSS for presentation |
| Related tag | <font> | Also deprecated; styled inline text in legacy HTML |
The <basefont> tag supported three attributes. Each maps directly to a CSS property today:
size LegacyValues 1–7 for relative font scale. Default was 3.
size="4" → font-sizecolor LegacyDefault text color using a color name or hexadecimal value.
color="green" → colorface LegacyComma-separated font family names with fallbacks.
face="Arial, sans-serif"All basefont attributes are historical only. The entire element is obsolete in HTML5.
Modern CSS replacements and historical basefont patterns. Do not use basefont in new code.
Modern equivalent using CSS on body (what you should use today):
This text uses CSS defaults: Georgia serif, slightly larger size, green color.
The recommended approach: define default typography on body in a <style> block or external stylesheet.
<style>
body {
font-size: 16px;
color: #334155;
font-family: system-ui, Arial, sans-serif;
}
</style>These examples show how <basefont> worked in legacy browsers. Do not use them in new code.
Set the default font scale from 1 (smallest) to 7 (largest), with 3 as the browser default.
<basefont size="4">Set the default text color for the entire document using a color name or hexadecimal value.
<basefont color="green">Specify the default font family with comma-separated fallbacks, similar to CSS font-family.
<basefont face="Helvetica, Arial, sans-serif">Combine font-size, color, and font-family on body to replace all three basefont attributes at once.
<style>
body {
font-size: 16px;
color: #166534;
font-family: Arial, sans-serif;
}
</style>When you find <basefont> in old HTML files, remove the tag and add equivalent CSS:
<!-- Legacy (remove) -->
<basefont size="4" color="green" face="Arial, sans-serif">
<!-- Modern replacement -->
<style>
body {
font-size: 1.125rem;
color: #16a34a;
font-family: Arial, sans-serif;
}
</style>Set size, color, or face for document-wide defaults.
Legacy browsers inherited font properties for all text until another <font> or <basefont> overrode them.
Stylesheets offered richer, maintainable typography control with media queries and cascading rules.
The <basefont> tag exists only in web history. Set default fonts with CSS for all new projects.
The <basefont> tag is not supported in modern browsers. Treat it as non-functional. Only legacy Internet Explorer recognized it.
Chrome, Firefox, Safari, and Edge ignore <basefont>. Use CSS on body for default typography instead.
Bottom line: Never use <basefont> in new code. Set default typography with CSS on the body selector.
The <basefont> tag served a purpose in early web development but is now obsolete. Use CSS on body for default typography, keep HTML for structure, and replace any legacy <basefont> tags with equivalent stylesheet rules.
body styles for default font-size, color, and font-familyrem units for accessible, scalable font sizes<basefont> when maintaining old sites<basefont> in any new HTML code<basefont> tagBookmark these before maintaining legacy code — they’ll guide every migration to modern CSS.
<basefont> set default page font size, color, and face in legacy HTML.
size (1–7), color, and face controlled document defaults.
The tag is deprecated and not valid in conforming HTML5 documents.
StatusSet font-size, color, and font-family on body.
Not supported in Chrome, Firefox, Safari, or Edge.
CompatibilityReplace basefont tags with equivalent rules in external stylesheets.
Migrationbody selector. Set font-size, color, and font-family in a stylesheet instead.font-size with px, rem, or em today.<basefont> tags found in legacy HTML with equivalent body styles.Skip deprecated basefont. Practice setting default typography with CSS in the Try It editor.
6 people found this page helpful