HTMLintermediate 7 min
header, nav, main, section, article and footer: tags that say what the content is.
How to replace anonymous <div> boxes with tags that describe their purpose.
Search engines and screen readers use these tags to understand the page. A screen reader user can jump straight to the <main> content or the <nav>, which is impossible if everything is a div.
Semantic means "carrying meaning". A <div> says nothing about its content. These tags do:
<header>: introductory content, often the logo and title.<nav>: a block of navigation links.<main>: the main content of the page. Use it once.<section>: a themed group of content, usually with a heading.<article>: a self-contained piece, like a blog post or a news item.<aside>: side content, such as a related-links box.<footer>: closing content, such as copyright and contact links.<figure> and <figcaption>: an image or diagram with a caption.They look plain by default. Style them with CSS.
<header> holds the site title and the <nav> links.<main> wraps the unique content of the page.<article> is a self-contained post with its own heading.<figure> pairs the image with a <figcaption> caption.<aside> is content related to, but separate from, the article.<footer> closes the page.Wrap a second post in another <article> inside <main>.
<div> for everything ("divitis").<main> on a page.<section> as a generic box. If it has no heading, a div may be better.header, nav, main, article, aside, footer.div only when nothing more meaningful fits.Next: making pages work for everyone.
<header>
<h1>My Blog</h1>
<nav>
<a href="#">Home</a> |
<a href="#">About</a>
</nav>
</header>
<main>
<article>
<h2>Learning HTML</h2>
<p>Semantic tags make pages easier to understand.</p>
<figure>
<img src="https://placehold.co/200x80/png?text=Diagram" alt="A simple diagram" width="200" height="80">
<figcaption>Figure 1: a diagram</figcaption>
</figure>
</article>
<aside>Related: CSS basics</aside>
</main>
<footer>Copyright 2025</footer>