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.
Use this HTML interview question to rehearse a quick answer, common mistake, follow-up, and production pitfall.
What are HTML tags?Frontend interview answer
This HTML interview question tests whether you can explain HTML tags explained: semantics, DOM structure, and common markup mistakes, connect it to production trade-offs, and handle common follow-up questions.
- HTML tags explained: semantics, DOM structure, and common markup mistakes explanation without falling back to memorized docs wording
- Tags and Elements reasoning, edge cases, and production failure modes
- How you would answer the most likely HTML interview follow-up
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 this as one explanation rep, then continue with the HTML interview questions cluster or a guided prep path.