A tag is the markup itself — the part wrapped in angle brackets. HTML has three kinds: paired tags, void (self-closing) tags, and — rarely seen today — deprecated tags you should avoid.
Paired Tags
<p>...</p>
<div>...</div>
<h1>...</h1>
Most tags come in an opening/closing pair and wrap content.
Void Tags
<img src="photo.jpg" alt="Description">
<br>
<hr>
<input type="text">
<meta charset="UTF-8">
<link rel="stylesheet" href="style.css">
These never wrap content and never have a closing tag — they're complete on their own.
Deprecated Tags — Avoid in New Code
| Deprecated Tag | Use Instead |
|---|---|
<center> | CSS text-align: center |
<font> | CSS font-family, color, font-size |
<marquee> | CSS animations (and generally, don't) |
<u> for styling | CSS text-decoration: underline — but see Underline Text for when <u> is still semantically appropriate |
Practical Use Case
Knowing which tags are deprecated matters when maintaining older codebases or reviewing legacy code — you'll recognize them immediately and know the modern replacement.
Common Mistakes
- Using presentational tags (
<b>,<i>) purely for visual bold/italic styling where a semantic tag (<strong>,<em>) would communicate meaning, not just appearance — see strong vs bold-text - Copy-pasting old code containing deprecated tags into a new project without updating it
Interview Relevance
You may be asked to name a few deprecated HTML tags and their modern replacements — a quick way to gauge whether a candidate has kept their knowledge current.
Practice Question
Rewrite <center><font color="red">Sale!</font></center> using modern HTML and CSS instead.