HTML <basefont> Tag

Beginner
⏱️ 6 min read
📚 Updated: Jun 2026
🎯 5 Examples
Deprecated HTML

What You’ll Learn

By the end of this tutorial, you’ll understand legacy basefont markup and the CSS approach used in modern web development.

01

Historical Syntax

How <basefont> set default size, color, and face for a page.

02

Key Attributes

Understand the legacy size, color, and face attributes.

03

Obsolete Status

Why HTML5 removed <basefont> from the specification.

04

CSS Replacement

Set font-size, color, and font-family on body.

05

Migration

Replace legacy basefont tags found in old HTML with stylesheet rules.

06

Modern Typography

Use external CSS and rem units for accessible, maintainable fonts.

What Was the <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.

⚠️
Deprecated — do not use

The <basefont> element is obsolete in HTML5. Modern browsers ignore it. Always use CSS to set default typography on body or via a stylesheet.

use-css-instead.css
body {
  font-size: 16px;
  color: #334155;
  font-family: system-ui, Arial, sans-serif;
}

📝 Syntax (Historical)

Legacy HTML combined all three attributes on one <basefont> tag:

syntax.html
<basefont size="3" color="blue" face="Arial, sans-serif">
  • size used a 1–7 scale (3 was default) → CSS font-size
  • color accepted color names or hex values → CSS color
  • face listed font families with fallbacks → CSS font-family

⚡ Quick Reference

AttributeLegacy ValuesCSS Replacement
size1 – 7 (3 default)font-size with px, rem, or em
colorColor name or hexcolor
faceComma-separated font listfont-family
StatusDeprecated / obsoleteNot supported in modern browsers
Modern approachbody { } ruleSet all defaults in one CSS rule
Related tag<font>Also deprecated; styled inline text

⚖️ <basefont> vs CSS

CSS replaced basefont entirely. Here is how the two approaches compare:

ApproachStatusNotes
<basefont>DeprecatedLimited to size/color/face; no media queries
CSS bodyModern standardFull typography control, responsive, maintainable
Separation of concernsBest practiceHTML for structure; CSS for presentation
Related tag<font>Also deprecated; styled inline text in legacy HTML

🧰 Attributes (Historical)

The <basefont> tag supported three attributes. Each maps directly to a CSS property today:

size Legacy

Values 1–7 for relative font scale. Default was 3.

size="4"  →  font-size
color Legacy

Default text color using a color name or hexadecimal value.

color="green"  →  color
face Legacy

Comma-separated font family names with fallbacks.

face="Arial, sans-serif"

All basefont attributes are historical only. The entire element is obsolete in HTML5.

Examples Gallery

Modern CSS replacements and historical basefont patterns. Do not use basefont in new code.

👀 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.

Modern CSS Replacement

The recommended approach: define default typography on body in a <style> block or external stylesheet.

css-replacement.html
<style>
  body {
    font-size: 16px;
    color: #334155;
    font-family: system-ui, Arial, sans-serif;
  }
</style>
Try It Yourself

📚 Historical Attributes

These examples show how <basefont> worked in legacy browsers. Do not use them in new code.

size Attribute

Set the default font scale from 1 (smallest) to 7 (largest), with 3 as the browser default.

size.html
<basefont size="4">

color Attribute

Set the default text color for the entire document using a color name or hexadecimal value.

color.html
<basefont color="green">

face Attribute

Specify the default font family with comma-separated fallbacks, similar to CSS font-family.

face.html
<basefont face="Helvetica, Arial, sans-serif">

Full Body CSS Styles

Combine font-size, color, and font-family on body to replace all three basefont attributes at once.

full-body-css.html
<style>
  body {
    font-size: 16px;
    color: #166534;
    font-family: Arial, sans-serif;
  }
</style>
Try It Yourself

🔄 Migrating Legacy Code

When you find <basefont> in old HTML files, remove the tag and add equivalent CSS:

migration.html
<!-- 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>

🧠 How <basefont> Worked

1

Author placed basefont in body

Set size, color, or face for document-wide defaults.

Markup
2

Browser applied defaults

Legacy browsers inherited font properties for all text until another <font> or <basefont> overrode them.

Rendering
3

CSS replaced the need

Stylesheets offered richer, maintainable typography control with media queries and cascading rules.

Evolution
=

Today: use CSS on body

The <basefont> tag exists only in web history. Set default fonts with CSS for all new projects.

Browser Support

The <basefont> tag is not supported in modern browsers. Treat it as non-functional. Only legacy Internet Explorer recognized it.

Obsolete · HTML5 removed

Non-functional in modern browsers

Chrome, Firefox, Safari, and Edge ignore <basefont>. Use CSS on body for default typography instead.

0% Modern support
Google Chrome Not supported · Obsolete
Not supported
Mozilla Firefox Not supported · Obsolete
Not supported
Apple Safari Not supported · Obsolete
Not supported
Microsoft Edge Not supported · Obsolete
Not supported
Internet Explorer Legacy only · EOL
Legacy only
Opera Not supported · Obsolete
Not supported
<basefont> tag 0% modern support

Bottom line: Never use <basefont> in new code. Set default typography with CSS on the body selector.

Conclusion

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.

💡 Best Practices

✅ Do

  • Use CSS body styles for default font-size, color, and font-family
  • Keep typography in external stylesheets for maintainability
  • Use rem units for accessible, scalable font sizes
  • Replace legacy <basefont> when maintaining old sites

❌ Don’t

  • Use <basefont> in any new HTML code
  • Mix deprecated font tags with modern semantic HTML
  • Rely on the 1–7 size scale—use explicit CSS units
  • Inline font styling when a stylesheet is available

Key Takeaways

Knowledge Unlocked

Six truths about the obsolete <basefont> tag

Bookmark these before maintaining legacy code — they’ll guide every migration to modern CSS.

6
Core concepts
🛠 02

Three Attributes

size (1–7), color, and face controlled document defaults.

Reference
⚠️ 03

Obsolete in HTML5

The tag is deprecated and not valid in conforming HTML5 documents.

Status
🎨 04

CSS Replacement

Set font-size, color, and font-family on body.

Modern
🚫 05

No Modern Support

Not supported in Chrome, Firefox, Safari, or Edge.

Compatibility
🔄 06

Migrate Legacy Code

Replace basefont tags with equivalent rules in external stylesheets.

Migration

❓ Frequently Asked Questions

It set the default font size, color, and face for all text in a document before CSS became the standard way to style pages.
No. It is deprecated and obsolete. Modern browsers do not support it.
CSS on the body selector. Set font-size, color, and font-family in a stylesheet instead.
It accepted values 1–7 for a relative font scale (3 was default). Use CSS font-size with px, rem, or em today.
Never. Use CSS for all typography. Replace any <basefont> tags found in legacy HTML with equivalent body styles.

Learn the CSS Replacement

Skip deprecated basefont. Practice setting default typography with CSS in the Try It editor.

Try CSS Styles →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

6 people found this page helpful