HTML <font> Tag

Beginner
5 min read
Updated: Oct 2026
4 examples
Live preview

Definition and Usage

The <font> element was used to set text color, typeface, and size on its content via color, face, and size. That puts presentation in HTML instead of CSS.

Do not use it in new pages. Style text with CSS color, font-family, and font-size — often on a <span> or a semantic element.

Deprecated.

Avoid in every new project. Browsers may still render old pages, but that does not make <font> valid modern HTML.

Study-only examples.

Legacy snippets below exist so you can recognize old markup and replace it. Prefer the CSS versions.

HTML Syntax

syntax.html
<font [color|face|size]>text</font>

Historical form only. Prefer this modern equivalent:

prefer.html
<span style="color: #c00; font-family: Georgia, serif; font-size: 1.25rem;">
  Styled with CSS
</span>

Attributes

Besides globals, legacy <font> used these presentation attributes. All are obsolete — use CSS instead.

AttributeDescriptionTry it
colorDeprecated. Named color or #RRGGBB. Replace with CSS colorTry it
faceDeprecated. Comma-separated font names. Replace with CSS font-familyTry it
sizeDeprecated. Absolute 1–7 (default 3) or relative like +1 / -2. Replace with CSS font-sizeTry it

Global Attributes

The <font> tag also supports the Global Attributes in HTML.

Live Preview

Compare obsolete <font> with the CSS replacement.

Same look, different approach. Prefer CSS in every new page.

Result
Styled text

Obsolete font element with color, face, and size.

HTML Examples

Short study snippets. Use Try It Yourself for a live editor. Prefer Example 4 in real projects.

Example 1 — Legacy color (Study Only)

Old pages set color with an attribute. Do not copy this into new work.

HTML
<p>
  <font color="#c00">Warning text</font>
</p>
Try It Yourself

How It Works

  1. Open <font> around the text to style.
  2. Set color to a name or #RRGGBB.
  3. Close the tag so only that span of text is colored.
  4. Replace later with CSS color on a modern element.

Example 2 — Legacy face (Study Only)

face listed preferred typefaces; the browser picked the first available.

HTML
<p>
  <font face="Georgia, Times New Roman, serif">Serif sample</font>
</p>
Try It Yourself

How It Works

  1. List fonts in face, comma-separated.
  2. End with a generic family such as serif or sans-serif.
  3. Know the limit: only installed fonts on the visitor’s device apply.
  4. Prefer CSS font-family (and @font-face when you load custom fonts).

Example 3 — Legacy size (Study Only)

Sizes ran from 1 (smallest) to 7 (largest); 3 was the default. Relative values like +1 adjusted from that baseline.

HTML
<p>
  <font size="5">Larger than default</font>
</p>
<p>
  <font size="-1">Slightly smaller</font>
</p>
Try It Yourself

How It Works

  1. Use 1–7 for absolute legacy sizes.
  2. Use +n / -n for relative steps from the default (3).
  3. Expect coarse control — not the fine scale of CSS.
  4. Replace with font-size using rem, em, or keywords.

Example 4 — Modern CSS Replacement (Preferred)

Same idea without <font>: a <span> plus CSS properties.

HTML
<p>
  <span style="color: #c00; font-family: Georgia, serif; font-size: 1.25rem;">
    Styled with CSS
  </span>
</p>
Try It Yourself

How It Works

  1. Wrap text in <span> (or a semantic tag) when you need a hook.
  2. Set color instead of the color attribute.
  3. Set font-family instead of face.
  4. Set font-size instead of size — prefer a class in real projects over inline styles.

Edge Cases & Pitfalls

Most font problems come from treating browser support as permission to keep using it.

obsolete

Still renders ≠ still allowed

Engines keep limited compatibility for old documents. That does not make <font> valid in new HTML.

css

Separate structure from style

HTML describes meaning; CSS handles look. Mixing them with color/face/size is hard to maintain and theme.

size

1–7 is not CSS

Do not map legacy sizes one-to-one into modern layouts. Use relative units so text scales with user settings.

a11y

Color alone is not meaning

Whether you use legacy color or CSS, do not rely on color alone for warnings or status. Add text or icons.

names

Not @font-face

The HTML element is unrelated to CSS @font-face, which loads custom fonts correctly.

Browser Support

The <font> element is legacy HTML kept for old pages. It is not a Node.js, Deno, or Bun API.

✓ Deprecated

<font>

Still rendered in major browsers for backward compatibility, but obsolete for authors. Prefer CSS color, font-family, and font-size.

— Do not use in new work
Google Chrome Legacy
Still renders
Mozilla Firefox Legacy
Still renders
Apple Safari Legacy
Still renders
Microsoft Edge Legacy
Still renders
Opera Legacy
Still renders
Samsung Internet Legacy
Still renders
Internet Explorer All
Supported (legacy)
<font> Obsolete (use CSS)

Bottom line: Recognize font in old markup, then replace it with CSS. Never ship new pages that depend on it.

Key Takeaways

  • Status: <font> is deprecated — avoid in new HTML.
  • Attributes: color, face, and size are all obsolete.
  • Replace with: CSS color, font-family, and font-size.
  • Hook: use <span> or a semantic element, not presentation tags.

One line: recognize <font> in old pages; style new text with CSS.

Default CSS Settings

There is no modern standard stylesheet for <font>. Legacy engines map attributes roughly like this:

legacy-map.css
/* Conceptual mapping — not for new code */
font[color] { color: /* attribute value */; }
font[face]  { font-family: /* attribute value */; }
font[size]  { font-size: /* mapped from 1–7 */; }

Use real CSS on modern elements instead of relying on this mapping.

Frequently Asked Questions

The font element set text color, typeface (face), and a coarse size (1–7) on its content. It mixed presentation into HTML and is obsolete.
No. It is deprecated. Do not use it in new projects. Style text with CSS instead.
Use CSS: color for color, font-family for typefaces, and font-size for size. Wrap with span or a semantic element when you need a hook.
Many browsers still honor them for old pages, but that is not a reason to write new font markup. Prefer CSS for consistent, accessible styling.
Legacy sizes 1–7 are absolute steps (3 is the default). In CSS use rem, em, or keywords like larger — not the old 1–7 scale.
No. The HTML font element is obsolete markup. @font-face loads custom fonts in CSS and is unrelated.

Next: footer

Learn the semantic footer element for page and section footers.

footer tutorial →

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.

12 people found this page helpful