The <basefont> tag also supports the Global Attributes in HTML (legacy recognition only — do not ship new markup).
Try it
Live Preview
Preview the CSS replacement for document defaults. Modern browsers ignore <basefont>, so this demo styles a sample with CSS instead.
Equivalent to what authors once hoped <basefont> would do — done correctly with CSS.
Sample text
Default document text should be easy to read. Style it with CSS on body, not with obsolete tags.
Using browser default sample styles.
Code
HTML Examples
Short snippets for study and migration. Use Try It Yourself for a live editor.
Example 1 — Legacy basefont (Study Only)
Recognize old markup. Do not copy this into new projects.
HTML
<!-- Deprecated — for study only -->
<body>
<basefont color="#334155" face="Helvetica, Arial, sans-serif" size="4">
<p>Page text would inherit these defaults in some old browsers.</p>
</body>
Exact size="1"–"7" mapping was never identical across browsers; prefer rem/em for new designs.
How It Works
Find each presentational attribute on the old <basefont>.
Write the matching CSS property on body.
Prefer modern units (rem, em) over the old 1–7 scale when redesigning.
Also migrate <font> spans the same way if they appear nearby.
Edge Cases & Pitfalls
The main risk is assuming ignored markup still sets typography.
obsolete
Never ship new <basefont>
HTML5 removed it. Validators will flag it; authors must use CSS.
support
Support was never consistent
Even historically, browsers disagreed. Relying on it always produced fragile layouts.
migrate
Ignoring the tag can change page look
If a legacy site “worked” only in an old UA, move the intended defaults into CSS explicitly.
related
Do not swap in <font>
<font> is also obsolete. Replace both with CSS properties.
size
The 1–7 scale is a rough map only
There is no exact CSS equivalent for every browser’s old size table. Redesign with modern units.
Compatibility
Browser Support
The <basefont> element is obsolete HTML. It is not part of modern authoring and is not a Node.js, Deno, or Bun API.
✓ Deprecated · Largely ignored
<basefont>
Removed from HTML5. Most modern browsers parse the tag but do not apply its presentational defaults. Use CSS for document fonts.
0%Authoring use (new pages)
Google ChromeIgnored (legacy)
Obsolete
Mozilla FirefoxIgnored (legacy)
Obsolete
Apple SafariIgnored (legacy)
Obsolete
Microsoft EdgeIgnored (legacy)
Obsolete
OperaIgnored (legacy)
Obsolete
Samsung InternetIgnored (legacy)
Obsolete
Internet ExplorerLegacy effect
Obsolete
<basefont>Do not use
Bottom line: Recognize it in old documents; replace with body CSS. Never teach it as a current technique.
Remember
Key Takeaways
Status:<basefont> is obsolete — do not use it in new HTML.
Replace:font-family, font-size, and color on body.
Legacy attrs:size, color, and face were presentational only.
Also obsolete: migrate <font> the same way when you find it.
One line: treat <basefont> as history, and set document fonts with CSS.
UA style
Default CSS Settings
Modern user agents do not apply meaningful presentational defaults from <basefont>. There is nothing reliable to style on the element itself. Use CSS like this instead:
replacement.css
/* Replacement for obsolete <basefont> defaults */
body {
font-family: system-ui, sans-serif;
font-size: 1rem;
color: #111;
}
Adjust family, size, and color to match the design — not the old 1–7 size table.
Frequently Asked Questions
No. basefont is obsolete in HTML. Do not use it in new pages. Set default typography with CSS on body (or a stylesheet) instead.
It once set a document-wide default font size, color, and face (font family). Text after it could inherit those presentational defaults in some legacy browsers.
Use CSS: font-family, font-size, and color on body (or a shared class). That is clearer, more controllable, and supported everywhere.
Usually they still display, but modern browsers largely ignore basefont, so the intended default font often never applies. Migrate those pages to CSS.
Legacy size used absolute values 1–7 (3 was the typical default) or relative values like +1 / -1. Map those ideas to CSS font-size with rem, em, %, or keywords such as large.
No. basefont tried to set a document default; font styled a span of text. Both are obsolete presentational elements — replace both with CSS.