Home HTML Tags <font> HTML <font> Tag Definition
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.
Syntax
HTML Syntax <font [color|face|size]>text </font>
Historical form only. Prefer this modern equivalent:
<span style="color: #c00; font-family: Georgia, serif; font-size: 1.25rem;">
Styled with CSS
</span> Reference
Attributes Besides globals, legacy <font> used these presentation attributes. All are obsolete — use CSS instead.
Attribute Description Try it colorDeprecated. Named color or #RRGGBB. Replace with CSS color Try itfaceDeprecated. Comma-separated font names. Replace with CSS font-family Try itsizeDeprecated. Absolute 1–7 (default 3) or relative like +1 / -2. Replace with CSS font-size Try it
Try it
Live Preview Compare obsolete <font> with the CSS replacement.
Code
HTML Examples Short study snippets. Use Try It Yourself for a live editor. Prefer Example 4 in real projects.
1. Legacy color 2. Legacy face 3. Legacy size 4. CSS replacement Example 1 — Legacy color (Study Only) Old pages set color with an attribute. Do not copy this into new work.
<p>
<font color="#c00">Warning text</font>
</p> How It Works Open <font> around the text to style.Set color to a name or #RRGGBB.Close the tag so only that span of text is colored.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.
<p>
<font face="Georgia, Times New Roman, serif">Serif sample</font>
</p> How It Works List fonts in face , comma-separated.End with a generic family such as serif or sans-serif.Know the limit : only installed fonts on the visitor’s device apply.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.
<p>
<font size="5">Larger than default</font>
</p>
<p>
<font size="-1">Slightly smaller</font>
</p> Larger than default
Slightly smaller
How It Works Use 1–7 for absolute legacy sizes.Use +n / -n for relative steps from the default (3).Expect coarse control — not the fine scale of CSS.Replace with font-size using rem, em, or keywords.Example 4 — Modern CSS Replacement (Preferred) Same idea without <font>: a <span> plus CSS properties.
<p>
<span style="color: #c00; font-family: Georgia, serif; font-size: 1.25rem;">
Styled with CSS
</span>
</p> How It Works Wrap text in <span> (or a semantic tag) when you need a hook.Set color instead of the color attribute.Set font-family instead of face.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.
Compatibility
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.
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.
Remember
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.
UA style
Default CSS Settings There is no modern standard stylesheet for <font>. Legacy engines map attributes roughly like this:
/* 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 What was the HTML font tag used for? 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.
Is the font tag valid in HTML5? No. It is deprecated. Do not use it in new projects. Style text with CSS instead.
What should I use instead of font? 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.
Do color, face, and size still work? 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.
How does font size 1–7 map to CSS? 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.
Is font the same as a CSS @font-face rule? 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 Developer, cloud engineer, and technical writer
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
Helpful Share Copy link Suggestion