Naar hoofdinhoud
← πŸ“„ HTML & the platformΒ·Module A2 Β· Les 6
πŸ› Los de bug opThis blog page has two heading-hierarchy bugs. (1) It uses TWO <h1> on the same page; collapse the second one to <h2>. (2) After the 'Main argument' h2 the page jumps straight to <h4> β€” fix it to <h3>. The final document should have exactly one h1, three h2 siblings ('Intro', 'Main argument', 'Conclusion'), and two h3 ('For', 'Against') under the second h2.

Kophiërarchie: één h1, sla nooit niveaus over

100 XP8 min
Theorie

Two rules screen readers enforce strictly

Rule 1: One `<h1>` per page. It identifies what the page is about. Two h1s confuse screen-reader users who navigate by heading shortcut (the equivalent of "skip to next heading"). Lighthouse will warn.

Rule 2: Don't skip heading levels going down. Going from <h1> to <h3> skips h2 β€” confusing both screen readers and outline parsers.

<!-- βœ“ Good -->
<h1>Blog post title</h1>
  <h2>Introduction</h2>
  <h2>The argument</h2>
    <h3>Sub-point</h3>
    <h3>Counter-argument</h3>
  <h2>Conclusion</h2>

<!-- βœ— Bad β€” h1 β†’ h3 -->
<h1>Title</h1>
  <h3>Sub-point</h3>

<!-- βœ— Bad β€” two h1s -->
<h1>Site name</h1>
<main>
  <h1>This page</h1>
</main>

Common pattern: site logo is NOT the h1

In a real site, your logo is in the header but the <h1> belongs to the page-specific content inside <main>. The logo is just a link, not the page topic.

<header>
  <a href="/"><img alt="MyApp" /></a>
</header>
<main>
  <h1>Pricing</h1>
  …
</main>

Going back UP is fine

Skipping back up is OK: h3 β†’ h2 is normal (next section). Only the going DOWN direction matters.

πŸ”’

Registreer om te beginnen met coderen

Theorie is voor iedereen. De editor, live preview en check ontgrendelen met een 7-daagse gratis proefperiode β€” kaart vereist, opzegbaar.

Registreren β€” gratis proef β†’

De eerste 10 lessen in elke track zijn gratis. Geen kaart nodig.

← VorigeVolgende les β†’

EΓ©n Python- of web-tip per dag β€” per e-mail

Kort, met de hand geschreven, geen spam. Met één klik afmelden.