Path // www.yourhtmlsource.comReference → <basefont>

<basefont>


The <basefont> element was used to set default font properties (face, size, and color) for an entire HTML document. It was a purely presentational element that mixed content with presentation, and has been replaced by CSS for all font styling.

Clock This page was last updated on 2025-11-17



Deprecation Warning

This element is obsolete and should not be used. The <basefont> element was deprecated in HTML 4.01 and removed from HTML5. All default font styling should be done with CSS.

The <basefont> element was particularly problematic because it was designed to be placed in the <head> section but affected body content, creating a confusing mixing of document structure. CSS provides a much cleaner and more maintainable way to set default typography.

Syntax

<basefont face="Arial" size="3" color="black">

This was an empty element (no closing tag) that was placed in the <head> section. It set defaults that <font> elements could then modify.

Modern Alternatives

Use CSS to set default font properties for your document:

Old HTML (Obsolete)

<head>
  <basefont face="Arial" size="3" color="#333333">
</head>

Modern CSS Equivalent

<head>
  <style>
    body {
      font-family: Arial, sans-serif;
      font-size: 16px;
      color: #333333;
    }
  </style>
</head>

Better: External Stylesheet

<!-- HTML -->
<head>
  <link rel="stylesheet" href="styles.css">
</head>

<!-- CSS (styles.css) -->
body {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 1rem;
  line-height: 1.5;
  color: #333333;
}

Modern Typography Best Practices

:root {
  --font-primary: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-size-base: 16px;
  --color-text: #333333;
}

body {
  font-family: var(--font-primary);
  font-size: var(--font-size-base);
  color: var(--color-text);
}

When to Avoid

Always avoid using <basefont>. There is no valid use case for this element:

  • It is obsolete in HTML5 and not supported
  • It mixes presentation with document structure
  • It fails validation for HTML5 documents
  • CSS provides far more powerful typography control
  • External stylesheets offer better maintainability
  • CSS allows responsive typography
  • <font> - Another deprecated element for font styling
  • <style> - Modern way to embed CSS in documents
  • <link> - For linking external stylesheets
  • <body> - Where CSS font properties are typically applied