Lesson 8 of 23

In progress

Course progress

HTML and CSS

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 div and span only when nothing more specific fits.

The page skeleton

HTML
Editable. Runs in your browser.





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.

HTML
Editable. Runs in your browser.





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
HTML
Editable. Runs in your browser.





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, aside and footer create landmarks that assistive technology can navigate.
  • section needs a heading; article is a self-contained item with its own header and footer.
  • div and span are 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?
Yes. A page-level header and an article-level header are both valid. Only one main element is allowed.
Do landmarks replace headings?
No. Landmarks help with navigation between regions; headings give the outline within them. Use both.

Full syllabus

Progress is saved in this browser only. No account, no email.

Admin

About the author

Admin

Instructor and technical writer at tutorials.in

Writes beginner lessons for tutorials.in. Each lesson is checked against the language or tool documentation, and examples are run before publishing.

Reviewed by the editorial team before publishing. Last updated November 16, 2026.