TechnicalEasy HTML & CSS

What is semantic HTML and why does it matter?

Asked for Frontend Developer, Full-Stack Developer

Why they ask this: Shows you care about accessibility and SEO, not only how a page looks.

Answer

Semantic HTML uses elements that describe their meaning, not only their appearance: <header>, <nav>, <main>, <article>, <section>, <aside>, <footer>, <button>, <label>, and headings <h1>–<h6> in order.

Why it matters:

  • Accessibility: screen readers use these landmarks and roles to navigate. A <button> is keyboard-focusable and clickable with Enter or Space by default; a clickable <div> is not.
  • SEO: search engines understand the page structure better.
  • Maintainability: the markup is easier for other developers to read.
html
<main>
  <article>
    <h1>Frontend Developer at Kathmandu Tech</h1>
    <p>...</p>
    <button type="button">Apply now</button>
  </article>
</main>

Can you explain this in your own words?

Back to question bank