MODULE 02 · SEMANTIC & STRUCTURAL HTML

Semantic HTML5 Elements

Give your markup real meaning — the tags that tell browsers, search engines, and screen readers what each part of your page actually is.

Day 09 of 30 Beginner ~20 min

Why "Meaning" Matters in HTML

Up to now you've mostly used generic building blocks. But HTML5 gives you tags that describe what a piece of content is, not just how it looks. That's called semantic HTML — and it's the difference between a page a machine can understand and one it can only render.

snippet.html
<!-- Non-semantic: a div tells nobody what it holds -->
<div class="top">My Site</div>

<!-- Semantic: header says exactly what it is -->
<header>My Site</header>

Both examples can look identical in the browser once styled. The difference lives underneath — in what a screen reader announces, what a search engine indexes, and what another developer instantly understands.

header, nav, main, footer

These four tags describe the major regions of a page. Every well-structured page tends to use all four in some form.

layout.html
<header>
  <h1>My Portfolio</h1>
  <nav>
    <a href="#about">About</a>
    <a href="#work">Work</a>
  </nav>
</header>

<main>
  <!-- the page's one-of-a-kind content goes here -->
</main>

<footer>
  <p>&copy; 2026 My Portfolio</p>
</footer>
CONCEPT PREVIEW
<header>Site title and branding
<nav>
HomeAboutContact
<main>The unique content of this specific page
<footer>Copyright, links, contact info

<main> should appear only once per page, and should hold content unique to that page — not sitewide navigation or repeated sidebars.

section, article & aside

Inside <main>, three more tags help you break content into meaningful chunks.

TAG WHEN TO USE IT
<section>

A thematic grouping of content, usually with its own heading — like a "Skills" or "Projects" block.

<article>

Content that could stand alone and be distributed on its own — a blog post, a news story, a product card.

<aside>

Content tangentially related to the main content — a sidebar, a pull-quote, related links.

blog.html
<section>
  <h2>Latest Posts</h2>

  <article>
    <h3>Learning Semantic HTML</h3>
    <p>Why meaning beats markup...</p>
  </article>

  <aside>
    <p>Related: CSS Basics</p>
  </aside>
</section>
RULE OF THUMB

Ask yourself: "If I copied this piece of content into a completely different site, would it still make sense on its own?" If yes, it's probably an <article>. If it only makes sense as one part of a bigger whole, it's a <section>.

Breaking Down What You Just Learned

1

<header> / <footer>Mark the top and bottom regions of a page or a section within it.

2

<nav>Wraps a block of major navigation links, distinct from every other link on the page.

3

<main>Holds the single, unique content of the page — used exactly once.

4

<section> / <article>Group related content thematically, or mark content that could stand entirely on its own.

5

<aside>Sets apart content that's related to but separate from the main flow, like a sidebar.

Try It Yourself

EXERCISE

Rewrite a page you built with only <div> tags so far, swapping the top section for <header>, the nav links for <nav>, the main content for <main>, and the bottom section for <footer>.

Build a Semantic Blog Layout

HANDS-ON EXERCISE

A page built entirely from semantic tags

Create a new file called day9.html inside your course folder and build a simple blog homepage.

  1. Start with the full DOCTYPE, html, head, and body structure.
  2. Add a <header> with a site title and a <nav> containing at least three links.
  3. Add a <main> with one <section> titled "Latest Posts."
  4. Inside that section, add two <article> elements, each with its own heading and paragraph.
  5. Add an <aside> next to the section with a short "About the Author" blurb.
  6. Close with a <footer> containing a copyright line.

Recap

HEADER / FOOTER

Mark the top and bottom regions of a page or section.

NAV

Wraps a page's primary block of navigation links.

MAIN

Holds the one unique piece of content on the page.

SECTION / ARTICLE / ASIDE

Group, isolate, or set apart pieces of content by meaning.

Key Takeaways

  • Semantic tags describe what content is, not just how it should look.
  • <header>, <nav>, <main>, and <footer> define the major regions of a page.
  • <section> groups related content; <article> marks content that stands alone.
  • <aside> sets apart tangential content like sidebars or related links.
  • Reach for <div> only when no semantic tag fits the content's role.
Course Overview