Lesson 8 of 23
In progress
Landmarks and semantic structure
Structure a page with header, nav, main, aside and footer, and give assistive technology regions it can jump between.
A page built from div elements looks fine and reads terribly. Semantic elements name the regions of a page, and those names become keyboard shortcuts for screen reader users and structure for search engines.
What you will learn
- Choose the right landmark for each part of a page.
- Nest sections and articles without breaking the outline.
- Use
divandspanonly when nothing more specific fits.
The page skeleton
Editable. Runs in your browser.
<main id="content">
<h1>Semantic structure</h1>
<p>One main region per page.</p>
</main>
<aside aria-label="Related">
<h2>Related lessons</h2>
<p>Links that support the article.</p>
</aside>
<footer>
<p>© 2026 Tutorials.in</p>
</footer>
</body>
Press Run to see the output.
header is introductory content for the page or a section. nav is a group of navigation links. main is the primary content, used once. aside is complementary content that still makes sense on its own. footer closes the page or section.
Browsers expose these as landmarks, and screen readers can list and jump between them. On a long page, that is the difference between reading everything and reaching the article in one keystroke.
A section becomes a named region only when it has an accessible name. The heading often provides it, and aria-labelledby pointing at that heading makes the relationship explicit. Without a name, the element still groups content, but it does not appear in a landmark list.
When a page has more than one nav, label them: aria-label="Main" and aria-label="Footer". Otherwise both are announced as "navigation", and the user cannot tell them apart.
Section and article
section groups content with a heading. article is a self-contained item that would make sense syndicated: a blog post, a card, a comment.
Editable. Runs in your browser.
<section>
<h2>Flexbox</h2>
<p>Layout in one dimension.</p>
</section>
<section>
<h2>Grid</h2>
<p>Layout in two dimensions.</p>
</section>
<article>
<h3>A card inside the page</h3>
<p>This could stand alone in a feed.</p>
</article>
</main>
Press Run to see the output.
A section without a heading is usually a div. The heading is what makes the region meaningful to the outline. article can contain its own header and footer, which then describe the article rather than the page.
Do not nest main inside main, and do not put main inside article. Those combinations confuse the landmark structure that the elements exist to provide.
The outline is not automatic
HTML5 does not generate a separate document outline from sectioning elements in the way early specifications suggested. Heading levels still do the work, so keep them in order inside each region.
A page with three h2 sections under one h1, and h3 inside each h2, reads correctly. A page with h4 because it looked right does not. Screen readers announce the level, and a skipped level sounds like a missing section.
If you want the visual size of an h2 on an h3, style it. The tag describes the structure; CSS describes the appearance.
When div and span are correct
div is a generic block container, span a generic inline container. They are right when you need a hook for styling or scripting and there is no semantic element for the job.
A card wrapper, a grid item, an icon wrapper: div is fine. A paragraph of text: p is better. A navigation list: nav with a ul. The rule is not "never use div"; it is "use a div when nothing more specific is true".
Wrapping every section in a div class="section" because that is what a tutorial did adds no meaning and makes the markup harder to read. If the content has a heading and belongs together, section says so. If it has no heading, the div was correct all along.
Take a page with a header, a two-column content area, a sidebar and a footer, and rewrite the wrappers as landmarks. Include one article inside main and label the sidebar.
Show solution
Editable. Runs in your browser.
<main>
<article>
<h2>First post</h2>
<p>The content of the post.</p>
</article>
</main>
<aside aria-label="About the author">
<h2>Author</h2>
<p>Writes about the web.</p>
</aside>
<footer>
<p>© 2026</p>
</footer>
Press Run to see the output.
The regions are now navigable and the article is a self-contained unit. The heading levels run h1, h2, h2 without skipping.
Recap
header,nav,main,asideandfootercreate landmarks that assistive technology can navigate.sectionneeds a heading;articleis a self-contained item with its own header and footer.divandspanare for styling hooks when no semantic element fits.
Next, you will make buttons and validation behave predictably, so actions do what their labels promise.
Can I have more than one header?
Do landmarks replace headings?
Progress is saved in this browser only. No account, no email.