HTML tags are the markup primitives browsers parse into a DOM tree. In production, choosing the right tag affects semantics, accessibility, SEO, and how reliably CSS and JavaScript can target the page.
What are HTML tags?
Core idea
HTML tags are not just angle-bracket syntax. They are the browser's structural hints for building the DOM tree, exposing semantics to assistive tech, and giving CSS and JavaScript reliable hooks. In production, the common mistake is treating every tag like a generic container when headings, landmarks, forms, and links carry meaning that changes accessibility and debugging.
<!doctype html>
<html>
<head>
<title>Profile</title>
</head>
<body>
<h1>Muslum</h1>
<p>Frontend developer</p>
<a href="/projects">View projects</a>
</body>
</html>
Tag | Meaning | When you use it |
|---|---|---|
| Main heading | Page or section title. |
| Paragraph text | Normal reading content. |
| Navigation link | Move to another page/section/resource. |
| Action trigger | Submit, open modal, start action. |
| Semantic structure | Readable, accessible page layout. |
Paired vs void tags
Most tags have opening + closing forms (). Some are void/self-contained like <p>...</p><img> and .
<p>Hello world</p>
<img src="avatar.jpg" alt="Profile photo">
<br>
Common mistakes
- Using
for everything instead of semantic tags.<div> - Breaking heading hierarchy (jumping from
to<h1>randomly).<h4> - Missing important attributes like image
altor linkhref.
Practical scenario
You build a blog card with <article>, , <h2>, and <p><a> so users, crawlers, and screen readers all understand content roles immediately.
Trade-off or test tip
Semantic HTML may feel slower at first than dropping everywhere, but it reduces accessibility and maintenance debt long-term.<div>
Think of tags as labels on folders. If every folder is named div, your team and assistive tech cannot quickly understand what is inside.
- Browsers convert tags into the DOM tree.
- Semantic tags improve accessibility, SEO, and maintainability.
- Good HTML makes CSS/JS simpler and more reliable.
<li>Tags define structure and meaning.Use the relevant interview-question hub first, then move into a concrete study plan before targeted company sets.