🌐 HTML

Semantic HTML

Lesson 5 of 5 ~6 min

You could build an entire page with just <div> and <span> tags — and the browser would render it fine. But that would be bad HTML. Semantic HTML means using tags that describe the meaning of your content, not just its container shape.

Why semantics matter

The semantic tags

<header>    Site or section header (logo, title, nav)</header>
<nav>       Navigation links</nav>
<main>      The primary content of the page</main>
<article>   Self-contained content (blog post, news story)</article>
<section>   Thematic grouping of content</section>
<aside>     Sidebar or tangentially related content</aside>
<footer>    Site or section footer (links, copyright)</footer>

Div vs semantic tags

Here's the same page structure written two ways — the non-semantic version and the semantic version:

Editor
HTML
Output

Try it

Replace the <header> with <div>, the <nav> with <div>, and so on. The visual output won't change — but you lose all the meaning that makes your page accessible and SEO-friendly.

When to use what

Quiz

Which tag should wrap the main navigation links?
Challenge

Take the page layout from the editor above and rewrite it using only semantic tags — replace every <div> with the most appropriate semantic element. Add a <section> inside the <main> that groups the article and sidebar together under an <h2>.