๐๏ธ Why Meaning Matters
In Module 1, you learned that HTML describes structure โ not appearance. Now we take the next step: the tags you choose should describe what your content means, not just how it's organized.
A <div> says "I'm a box." A <nav> says "I contain navigation links." Both are containers โ but only one tells the browser, screen readers, and search engines what's inside.
๐ฏ By the end of this module, you will:
- Understand why semantic tags are better than generic divs
- Use the 7 structural semantic tags correctly
- Build a proper document outline with headings h1โh6
- Know which text-level tags carry meaning vs just styling
- Understand how semantic HTML enables accessibility
- See how search engines use semantic HTML for SEO
๐ The Div Soup Problem
When beginners build web pages, they tend to use <div> for everything. The result is what developers call "div soup" โ a page full of meaningless containers. It works visually, but it's a disaster for everything else.
<div class="header"> <div class="logo">My Site</div> <div class="nav"> <div class="link">Home</div> <div class="link">About</div> </div> </div> <div class="main"> <div class="title">Welcome</div> <div class="text">Hello world</div> </div> <div class="footer">ยฉ 2026</div>
<header> <h1>My Site</h1> <nav> <a href="/">Home</a> <a href="/about">About</a> </nav> </header> <main> <h2>Welcome</h2> <p>Hello world</p> </main> <footer>ยฉ 2026</footer>
Both versions look exactly the same in a browser. But only the semantic version communicates meaning.
What Div Soup Breaks
Screen readers can't find the navigation, main content, or footer. Blind users must listen to every single element to find what they need.
Search engines can't tell your heading from your paragraph. They see a flat wall of content with no structure to index.
Another developer opens your code and sees 200 divs. Which one is the header? Which one is the sidebar? Reading becomes guessing.
You need extra classes for everything because all your tags are the same. With semantic tags, you can style nav a directly โ no class needed.
<div>, pause and ask: "Is there a semantic tag that describes what this content IS?" If yes โ use it. <div> should be your last resort, not your default.
๐ค Choosing the Right Tag
Not sure which tag to use? Walk through this decision tree. Start at the top and follow the questions.
The Decision Tree
Yes โ <nav>. No โ continue โ
Yes โ <main> (only one per page). No โ continue โ
Yes โ <header>. No โ continue โ
Yes โ <footer>. No โ continue โ
Yes โ <article>. No โ continue โ
Yes โ <section>. No โ continue โ
Yes โ <aside>. No โ continue โ
Use <div> โ but only for layout/styling purposes. It has no semantic meaning.
๐ฐ Headings & Document Outline
Headings (<h1> to <h6>) are not just big text โ they create the document outline, a table of contents that screen readers and search engines use to navigate your page.
<h1>My Recipes</h1> <h4>Pasta Carbonara</h4> <!-- h4 because "h2 looks too big" --> <h6>Ingredients</h6> <!-- h6 to get small text --> <h6>Steps</h6> <!-- skipped h2, h3, h4, h5! --> <h2>A small tip</h2> <!-- h2 after h6?! chaos -->
<h1>My Recipes</h1> <h2>Pasta Carbonara</h2> <h3>Ingredients</h3> <h3>Steps</h3> <h2>Chocolate Cake</h2> <h3>Ingredients</h3> <h3>Steps</h3>
The Heading Rules
<h4> or <h5> because they want "smaller text." That's using HTML for appearance โ which violates our core principle. Choose headings for hierarchy, then style them with CSS.
โ๏ธ Text-Level Semantics
Beyond structure, some tags add meaning within text. The key question is always the same: does this tag carry meaning, or does it just change appearance?
โ Tags with Meaning (Use These)
<strong>
Strong importance. Screen readers change their voice tone. Appears bold โ but the meaning is "this is important".
<em>
Stress emphasis. Screen readers emphasize this word. Appears italic โ but the meaning is "emphasize this".
<time>
Machine-readable date/time. Browsers and search engines can parse it. <time datetime="2026-01-15">Jan 15</time>
<abbr>
Abbreviation with expansion. <abbr title="HyperText Markup Language">HTML</abbr> โ hover to see the full form.
<code>
Inline code. Tells the browser this is a fragment of computer code, not regular text.
<cite>
The title of a creative work โ a book, film, song, or paper. Not for the person's name.
<mark>
Highlighted text โ relevant in a search context. The meaning is "pay attention to this", not "make it yellow".
โ Tags That Only Style (Avoid These)
These tags exist in HTML, but they carry no semantic meaning. They only change appearance โ which is CSS's job.
<b>
Bold text with no importance. Use <strong> if the text is important, or CSS font-weight: bold if it's purely visual.
<i>
Italic text with no emphasis. Use <em> if you want emphasis, or CSS font-style: italic if it's purely visual.
<u>
Underlined text. Often confused with links. Use CSS text-decoration: underline if truly needed (rarely is).
<s>
Strikethrough text. Use <del> if content was deleted (semantic), or CSS text-decoration: line-through for visual effect.
<b>, <i>, <u>, <s>, <br>, <hr> are all presentation. We don't use them. Exception: <strong> and <em> are fine because they carry semantic meaning โ screen readers change their voice to convey importance and emphasis.
๐ Grouping Elements
Some semantic tags group content in meaningful ways โ adding context that plain <div> containers can't provide.
โฟ Accessibility: Free for Semantic HTML
When you use semantic HTML, screen readers automatically map your tags to ARIA landmark roles. This means blind users can jump directly to the navigation, main content, or footer โ just like sighted users scan a page visually.
Semantic Tags โ ARIA Landmarks
<header>
banner
"Banner landmark"
<nav>
navigation
"Navigation landmark"
<main>
main
"Main landmark"
<aside>
complementary
"Complementary landmark"
<footer>
contentinfo
"Content info landmark"
<div>
(none)
(silence โ invisible to screen readers)
<div> for everything means you'd have to manually add role="navigation", role="main", etc. โ and most developers forget. Use the right tag, and the browser does the work for you.
"My Site. Home. About. Welcome. Hello world. ยฉ 2026."
(Reads everything linearly โ no landmarks, no way to skip.)
"Banner landmark. Navigation: Home, About. Main landmark: heading level 2 Welcome. Paragraph: Hello world. Content info landmark: ยฉ 2026."
(User can jump directly to any landmark!)
๐ SEO: Helping Search Engines Understand You
Search engines like Google use your HTML structure to understand your content. Semantic HTML tells them: "Here's the main content, here are the navigation links, here's a blog article." This directly affects how (and whether) your page appears in search results.
Google prioritizes <main> content over <header> and <footer>. It knows what's core and what's boilerplate.
Semantic tags like <article>, <time>, and proper headings enable rich snippets, featured answers, and news carousels.
A clean h1 โ h2 โ h3 hierarchy tells Google your content structure. This helps it generate sitelinks and table-of-contents snippets.
Most sites still use div soup. Using semantic HTML correctly gives you an advantage in rankings, accessibility compliance, and code quality.
โ๏ธ Practice: Semantic Refactoring
Look at each piece of HTML below. Identify the semantic problems, then reveal the correct version.
Exercise 1: Fix the Structure
This page uses only divs. Rewrite it mentally with semantic tags, then reveal the answer.
<div class="header"> <div class="title">My Portfolio</div> <div class="links"> <div>Home</div> <div>Projects</div> <div>Contact</div> </div> </div> <div class="content"> <div class="project"> <div class="project-title">Weather App</div> <div class="desc">A simple weather app</div> </div> </div> <div class="bottom">ยฉ 2026</div>
<header> <h1>My Portfolio</h1> <nav> <a href="/">Home</a> <a href="/projects">Projects</a> <a href="/contact">Contact</a> </nav> </header> <main> <article> <h2>Weather App</h2> <p>A simple weather app</p> </article> </main> <footer>ยฉ 2026</footer>
Exercise 2: Spot the Errors
This code uses semantic tags, but makes several mistakes. Find them all, then reveal the answer.
<main> <h3>Welcome to My Blog</h3> <!-- ?? --> <main> <!-- ?? --> <article> <h5>My First Post</h5> <!-- ?? --> <b>Important!</b> <!-- ?? --> <div>This is my content...</div> <!-- ?? --> </article> </main> </main>
โ <h3> as first heading โ should be <h1> (one per page, top of hierarchy).
โ Two <main> elements โ only one <main> per page. Remove the inner one.
โ <h5> after <h1> โ should be <h2> (never skip heading levels).
โ <b> for importance โ use <strong> (semantic emphasis, not just bold styling).
โ <div> for a paragraph โ use <p> (it's text content).
Exercise 3: Choose the Right Tag
For each description, which semantic tag should you use?
1. A sidebar with related links and author bio.
โ<aside>
2. A product card in an e-commerce grid.
โ<article> (self-contained, could be syndicated)
3. A "Features" section with three feature cards.
โ<section> (thematic grouping with a heading)
4. A breadcrumb trail at the top of the page.
โ<nav> (it's a navigation aid)
5. An image with a caption explaining it.
โ<figure> + <figcaption>
๐ Module Summary
Choose tags that describe what content IS, not how it looks. HTML = meaning, CSS = presentation.
<div> is a last resort. Always ask: "Is there a semantic tag for this?" Use the Decision Tree.
header, nav, main, section, article, aside, footer โ they define the anatomy of every page.
One h1, never skip levels, use for hierarchy not size. Headings create a table of contents.
Semantic tags = ARIA landmarks for free. Screen readers navigate by landmarks โ divs are invisible.
<b>, <i>, <u>, <s>, <br>, <hr> are presentation โ use CSS. Exception: <strong> and <em> carry semantic meaning.