By the end of this lesson, you will:
<header>, <main>, <section>, <article>, and <footer>.<div> and <span> that don’t communicate the role of the content they contain.You’ve already learned how to structure HTML with basic tags. Now it’s time to write smarter, not just more. Semantic HTML helps browsers, search engines, and screen readers understand your content on a deeper level.
In this lesson, you’ll discover how to make your HTML more readable, organized, and future-proof by using tags that describe what your content means.
| Semantic Tag | Replaces | Description |
|---|---|---|
<header> |
<div class="header"> |
Introductory content or site navigation |
<nav> |
<div class="nav"> |
A group of links for site navigation |
<main> |
<div id="main"> |
The primary content of the page |
<section> |
<div class="section"> |
A standalone section with a heading |
<article> |
<div class="article"> |
A self-contained piece (like a blog post) |
<aside> |
<div class="sidebar"> |
Extra info like sidebars or callouts |
<footer> |
<div class="footer"> |
Closing or copyright information |
❌ Non-Semantic HTML:
<div class="header">
<h1>Welcome to My Blog</h1>
</div>
<div class="content">
<div class="post">
<h2>First Post</h2>
<p>Today I learned about semantic HTML.</p>
</div>
</div>
<div class="footer">
<p>Copyright 2025</p>
</div>
✅ Semantic HTML:
<header>
<h1>Welcome to My Blog</h1>
</header>
<main>
<article>
<h2>First Post</h2>
<p>Today I learned about semantic HTML.</p>
</article>
</main>
<footer>
<p>Copyright 2025</p>
</footer>
Notice how the second example is more meaningful—even without class names.
<div> and <span> tags with proper semantic tags.<header>, <nav>, <main>, <article>, <aside>, and <footer>.<div>s?📚 Designing with Web Standards – Jeffrey Zeldman
📚 Inclusive Design for a Digital World – Regine Gilbert
🛠 MDN Web Docs: Semantic HTML
🛠 WAVE Accessibility Tool
🛠 HTML5 Outliner
Semantic HTML isn’t about writing more code—it’s about writing better code. When you use meaningful tags, you help machines and humans understand your content faster and more clearly.
This shift from “just making it work” to “making it understandable” is a major milestone in your journey as a web developer.
Open your most recent HTML project. Identify at least five non-semantic tags (<div> or <span>) and replace them with appropriate semantic tags. Then validate your changes by opening the page in your browser and checking for any layout changes.
Not a member yet? Register now
Are you a member? Login now