Semantic elements describe their meaning, not just their look. They help search engines, screen readers and other developers understand your page.
| Element | Use it for |
|---|---|
<header> |
Top of the page or a section: logo, title |
<nav> |
Main navigation links |
<main> |
The main content (only one per page) |
<section> |
A group of related content with a heading |
<article> |
Independent content: blog post, news item |
<aside> |
Side content: sidebar, related links |
<footer> |
Bottom: copyright, contact links |
Using <nav> instead of <div class="nav"> gives the same look but adds meaning — good for SEO and accessibility.
Example
Example — A semantic page layout
HTML
<header>
<h1>My Blog</h1>
<nav>
<a href="#">Home</a> | <a href="#">Posts</a> | <a href="#">Contact</a>
</nav>
</header>
<main>
<article>
<h2>Learning HTML in 30 days</h2>
<p>Here is how I learnt HTML step by step...</p>
</article>
<aside>
<h3>Related posts</h3>
<p>CSS basics</p>
</aside>
</main>
<footer>
<p>© 2026 My Blog</p>
</footer>