Skip to the workspace
Pebellslearn by building
HTML  ›  Lesson

Semantic HTML — Say What It Is

HTML 14 minSemantic elements such as header, nav, main, article and footer describe the role of content, and heading levels describe the outline rather than the size.

frontend / Semantic HTML — Say What It Is

Explore each scene at your own pace.

01 · The rule

The rule

Semantic HTML — Say What It Is

You could build the entire bakery page out of <div> elements and style it to look perfect. A sighted visitor would never know. But a blind customer using a screen reader would hear one long, flat stream of text, with no way to jump to the menu or skip the navigation. Choosing meaningful elements fixes that for free.

The rule

Pick the element that says what the content is, not how it looks.

HTML has elements whose names describe a role. Browsers, screen readers and search engines understand those roles.

<body>
  <header>
    <p>Crumb Bakery</p>
    <nav>
      <a href="/">Home</a>
      <a href="/menu">Menu</a>
      <a href="/visit">Visit us</a>
    </nav>
  </header>
  <main>
    <h1>Today's bakes</h1>
    <section>
      <h2>Breads</h2>
      <article>
        <h3>Country sourdough</h3>
        <p>Three-day ferment, crackly crust.</p>
      </article>
    </section>
    <aside>
      <h2>Allergy notice</h2>
      <p>All items are made in a kitchen that uses nuts.</p>
    </aside>
  </main>
  <footer>
    <p>Open 7am to 3pm, Tuesday to Sunday.</p>
  </footer>
</body>
Element Role
<header> Introductory content, often a logo and navigation
<nav> A block of main navigation links
<main> The page's unique main content; one per page
<section> A themed group of content, normally with its own heading
<article> A self-contained item that would make sense on its own: a post, a product card
<aside> Related but secondary content
<footer> Closing information: contact, copyright, hours

Headings <h1> to <h6> form the page's outline. Use them by level, not by size: one <h1> for the page's main topic, <h2> for its sections, <h3> inside those, and do not skip levels. If you want a smaller-looking <h2>, change its size with CSS.

The same thinking applies inside text: <strong> means important, <em> means stressed, <button> means something clickable that performs an action. A <div> or <span> is still the right choice when there is genuinely no meaning, only a hook for styling.

Scene 1 of 5
Hover to wake the cannons. Drag to move, or use arrow keys when focused. Press Enter to fire a shot.