Loading lessons...
Obsolete Elements
Obsolete Elements
Some old tags used to be popular... but no longer! Browsers might still show them, but you should NOT use them. Here's the museum of old tags.
Formatting tags: use CSS instead!
<font>: used to change font. Use CSSfont-familyinstead!<center>: centered text. Use CSStext-align!<big>: bigger text. Use CSSfont-size!<tt>: typewriter text. Usefont-family: monospace!<strike>/<s>: struck text.<s>is still fine;<strike>is obsolete.
<!-- Old, don't do this: -->
<font color="red">Red</font>
<!-- Modern: -->
<p style="color: red;">Red</p>
Layout tags: use CSS layout instead!
<center>: done above.<marquee>: scrolling text (annoying and obsolete!).
<!-- Please don't use marquee! -->
<marquee>Do not use me!</marquee>
Frames: use iframe instead!
<frameset>: old page layouts with multiple frames.<frame>: one frame inside a frameset.<noframes>: fallback content for browsers without frames.
All replaced by modern CSS layout and <iframe>.
Other old friends
<acronym>: old version of<abbr>.<dir>: old directory list; use<ul>.<param>: old parameters for<object>.<plaintext>: displayed everything as plain text.<xmp>: old "example" text tag.<rb>/<rtc>: old ruby parts.<nobr>: no line breaks (obsolete).<noembed>: fallback for old browsers.
How to know if a tag is obsolete?
- The W3C validator will warn you.
- MDN marks it with "Deprecated" or "Obsolete".
- If CSS can do it, CSS should do it.
TL;DR
<font>,<center>,<big>,<tt>,<strike>→ use CSS.<marquee>→ just don't.<frameset>/<frame>/<noframes>→ use CSS layout +<iframe>.<acronym>→ use<abbr>.- When in doubt, check the validator or MDN.