Imagine moving to a new house with boxes that have no labels. To find the plates, you have to open the boxes one by one. A page made only of <div>s is like those boxes with no labels: a <div> is a plain box, with nothing to tell you what it holds.
A semantic tag is a tag whose name says what it holds, like a box with a label. For example, <header>, <nav> and <main> tell you right away: "this is the top of the page", "this is the menu", "this is the main content". Anyone reading the code knows what each part holds from the tag's name.
The page's skeleton
Here is the skeleton of a page written with semantic tags:
<header>
<h1>Folk Tales</h1>
</header>
<nav>
<a href="#home">Home</a>
<a href="#stories">Stories</a>
<a href="#about">About</a>
</nav>
<main>
<h2>The Legend of the Lake</h2>
<p>The page's main content lives here.</p>
</main>
<aside>
<p>Other popular stories</p>
</aside>
<footer>
<p>© 2026 Folk Tales</p>
</footer>
<header>is the top of the page: the site title or a logo.<nav>wraps the menu links.<main>wraps the page's main content. A page has only one<main>.<aside>wraps side content: a sidebar (a side column), an ad, related links.<footer>is the bottom of the page: copyright, contact details. The©in the example is the code for the © symbol.
Semantic tags are wrappers. The titles and paragraphs inside them are still written with <h1>, <h2> and <p>.
If you replace all these tags with <div>s, does the page look different? Not at all. The browser gives semantic tags no special look, so the page looks exactly the same.
The difference is in the meaning. A screen reader (a program that reads pages aloud for blind users) makes a list of these parts. From that list, its user can go directly to the menu or to the main content. Search engines can also see which part is the main content.
<article> for content that stands on its own
<article> wraps content that still makes sense when moved to another page, such as a news item, a blog post or a comment. Write its title and its text inside the <article>:
<article>
<h2>The Night Market Is Back</h2>
<p>From Friday, the night market stays open until 11 pm.</p>
</article>
<aside>
<p>Ad: free delivery this week!</p>
</aside>
The ad isn't part of the news, so it goes in an <aside>. There is also <section>. It groups one part of a page that has its own title, such as the "Pricing" part of a product page.
Use the tag with the right name
With CSS, a <div class="footer"> can be made to look like a <footer>. But class is only an attribute that gives a name for CSS to use. That name means nothing to the browser. So when a semantic tag fits a part of the page, use that tag. The tag also has to exist in HTML: <bottom> and <sidebar> are not HTML tags.
How many of each: only one <main>. You may have more than one <nav>, for example a top menu and a side menu. Each <nav> should then get its own label, in the aria-label attribute, so screen reader users know which menu is which: <nav aria-label="Main menu">. The label doesn't show on the page, but a screen reader reads it aloud.
⚠️ Labels stuck on the wrong box
- Wrapping everything in
<header>,<main>and<footer>. News goes in<article>, an ad goes in<aside>. Choose the tag by what the content is, not by where it is in the code. - A title outside the
<article>. A title written before the<article>doesn't count as the title of that news item. Write the title inside the<article>. - A
<section>with no title.<section>is for a part that has a title. If you only need a wrapper for CSS, a<div>is enough.
TL;DR: A semantic tag's name says what it holds. <header> is the top of the page, <nav> the menu, <main> the main content (only one), <aside> side content, <footer> the bottom of the page. <article> is for content that stands on its own, such as a news item, with its title and text inside it. Semantic tags look the same as <div>, but screen readers and search engines can read their meaning. You can have several <nav>s, each with an aria-label.
⚡ Labelled boxes
Write:
<header>
<h1>Folk Tales</h1>
</header>
<nav>
<a href="#home">Home</a>
<a href="#stories">Stories</a>
</nav>
<main>
<h2>The Legend of the Lake</h2>
<p>The page's main content lives here.</p>
</main>
<footer>
<p>© 2026 Folk Tales</p>
</footer>
Meaning: These are semantic tags: tags whose names say what they hold, like boxes with labels. <header> is the top of the page, <nav> the menu, <main> the main content (only one per page), <footer> the bottom of the page. There is also <aside> for side content.
⚡ Same look, different meaning
Guess first: if you replace all those tags with <div>s, does the page look different?
Not at all. The browser gives semantic tags no special look.
Meaning: The difference is in the meaning. A screen reader makes a list of these parts, so its user can go directly to the menu or the main content. Search engines can also see which part is the main content.
⚡ News goes in <article>
Write:
<article>
<h2>The Night Market Is Back</h2>
<p>From Friday, the night market stays open until 11 pm.</p>
</article>
<aside>
<p>Ad: free delivery this week!</p>
</aside>
Meaning: <article> is for content that still makes sense when moved to another page, such as a news item. Its title goes inside the <article>. The ad isn't part of the news, so it goes in an <aside>.
⚡ More than one menu
Meaning: There is only one <main>, but you can have more than one <nav>, for example a top menu and a side menu. Each <nav> should get its own label: <nav aria-label="Main menu">. A screen reader reads the label aloud.