JavaScript Curriculum
Semantic HTML
easyThe coffee shop's page works, but it's a wall of divs. A screen reader user can't find the menu, the nav, or the main content. Let's rebuild it with proper semantic structure.
Semantic HTML
HTML5 introduced a set of elements that carry meaning — not just structure. Instead of <div class="header">, you write <header>. The browser, screen readers, and search engines all understand what that element is, not just where it sits on the page.
Why Semantics Matter
The Landmark Elements
Every semantic layout element maps to an ARIA landmark role automatically — no aria-role attribute needed:
← Click any region in the wireframe to learn about it
Divs vs Semantics: The Real Difference
<div class="header">
<div class="logo">Coffee Shop</div>
<div class="nav">
<div class="nav-link">Menu</div>
<div class="nav-link">About</div>
</div>
</div>
<div class="main">
<div class="post">
<div class="post-title">Our Story</div>
<div class="post-body">We started in 2010...</div>
</div>
</div>
<div class="sidebar">
<div class="widget">Opening Hours</div>
</div>
<div class="footer">© 2025 Coffee Shop</div>section vs article — The Hardest Call
The most common confusion in semantic HTML is choosing between <section> and <article>. The rule is one question:
Can this content be lifted out of the page and still make sense on its own?
If yes → <article>. If no → <section>.
A blog post about brewing methods
Your Challenge
Restructure the coffee shop page with proper semantic landmark elements. Replace every div that has a layout role with the correct semantic element.
Challenge
Restructure the coffee shop page using semantic elements: wrap the logo and nav in a header, put the main content in main, move the opening-hours widget into an aside, wrap each menu section in a section element with a heading, and close with a footer containing the copyright.
Semantic HTML
easyThe coffee shop's page works, but it's a wall of divs. A screen reader user can't find the menu, the nav, or the main content. Let's rebuild it with proper semantic structure.
Semantic HTML
HTML5 introduced a set of elements that carry meaning — not just structure. Instead of <div class="header">, you write <header>. The browser, screen readers, and search engines all understand what that element is, not just where it sits on the page.
Why Semantics Matter
The Landmark Elements
Every semantic layout element maps to an ARIA landmark role automatically — no aria-role attribute needed:
← Click any region in the wireframe to learn about it
Divs vs Semantics: The Real Difference
<div class="header">
<div class="logo">Coffee Shop</div>
<div class="nav">
<div class="nav-link">Menu</div>
<div class="nav-link">About</div>
</div>
</div>
<div class="main">
<div class="post">
<div class="post-title">Our Story</div>
<div class="post-body">We started in 2010...</div>
</div>
</div>
<div class="sidebar">
<div class="widget">Opening Hours</div>
</div>
<div class="footer">© 2025 Coffee Shop</div>section vs article — The Hardest Call
The most common confusion in semantic HTML is choosing between <section> and <article>. The rule is one question:
Can this content be lifted out of the page and still make sense on its own?
If yes → <article>. If no → <section>.
A blog post about brewing methods
Your Challenge
Restructure the coffee shop page with proper semantic landmark elements. Replace every div that has a layout role with the correct semantic element.
Challenge
Restructure the coffee shop page using semantic elements: wrap the logo and nav in a header, put the main content in main, move the opening-hours widget into an aside, wrap each menu section in a section element with a heading, and close with a footer containing the copyright.