HTML5 Semantic Landmarks: header, nav, main, and footer
Lesson 5 of 36 in the HTML5 learning path.
How do I structure header, nav, main, article, section, aside, and footer?
HTML5 landmark elements name the large regions of a page so people and software can move through it with intent. header introduces the site or a section, nav holds a group of links, main wraps the primary content, and footer closes the region with information that repeats. Inside main, article is a self-contained piece, section is a thematic block with its own heading, and aside is related material that is not the main thread. Those names are in the accessibility tree. A pile of div elements can look the same and still give a screen reader nothing to jump to.
Build this skeleton on any full page: a course article, a department homepage, a handbook chapter. Use one main element so the primary content is obvious. Put navigation in nav, not in a line of links with no group. Keep aside for supporting notes such as files to bring or a short author bio.
Syntax & Parameters
<header><nav></nav></header><main><article><section></section></article><aside></aside></main><footer></footer>
Example
Interactive preview available<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Writing pages people can scan</title>
<style>
body { margin: 0; font: 1.05rem/1.55 Georgia, "Times New Roman", serif; color: #1c1917; background: #faf7f2; }
header, footer { background: #1e3a5f; color: #f8fafc; padding: 1rem 1.5rem; }
header a { color: #bfdbfe; margin-right: 1rem; }
main { max-width: 46rem; margin: 0 auto; padding: 1.25rem 1.5rem 2rem; }
article { margin-bottom: 1.5rem; }
aside { background: #fff; border: 1px solid #e7e5e4; padding: 0.75rem 1rem; }
h1 { font-size: 2rem; line-height: 1.2; margin: 0 0 0.75rem; }
h2 { font-size: 1.25rem; margin: 1.2rem 0 0.4rem; }
p { margin: 0 0 0.8rem; }
a { color: #1d4ed8; }
</style>
</head>
<body>
<header>
<p>North Campus Learning</p>
<nav>
<a href="/courses">Courses</a>
<a href="/labs">Labs</a>
<a href="/faculty">Faculty</a>
</nav>
</header>
<main>
<article>
<h1>Writing pages people can scan</h1>
<p>Published for Web Systems 1 on 26 November 2026.</p>
<section>
<h2>Landmarks on this page</h2>
<p>The header holds the site name and the primary navigation. The main element wraps the article and the aside. The footer closes the page with the department line.</p>
</section>
<section>
<h2>Why the names matter</h2>
<p>A screen reader can list landmarks. Header, navigation, main, and contentinfo become jumps, so a student does not have to walk every link to reach the article.</p>
</section>
</article>
<aside>
<h2>Workshop files</h2>
<p>Bring index.html from lab one. You will add these regions around the paragraph you already wrote.</p>
</aside>
</main>
<footer>
<p>Department of Computer Studies</p>
</footer>
</body>
</html>
Expected Output
The browser shows a navy banner with North Campus Learning and three links: Courses, Labs, and Faculty. Below that, the article heading Writing pages people can scan appears with a date line, two sections with h2 headings, and a bordered aside titled Workshop files. The footer returns to navy and reads Department of Computer Studies. The accessibility tree exposes a banner from header, a navigation landmark from nav, a main landmark, and contentinfo from footer. The aside is complementary content inside main. The links go to /courses, /labs, and /faculty on the same host. No region is a nameless div.
Line-by-Line Walkthrough
- The header is the banner for North Campus Learning and contains the primary nav, so the site name and the main links travel together.
- The nav wraps only the course, lab, and faculty links. A single navigation landmark does not need an extra ARIA label.
- The main element begins the primary content and contains both the article and the aside.
- The article is the self-contained piece, with one h1 that names the page a classmate came to read.
- The first section, Landmarks on this page, is a thematic block with its own h2 inside the article.
- The second section, Why the names matter, is a sibling section, not a div styled to look like a heading.
- The aside holds Workshop files, supporting material that is related to the article and is not the article itself.
- The footer is outside main and carries the department line, which browsers expose as the contentinfo landmark.
- CSS only paints the banner, the column width, and the aside border. Removing the stylesheet would leave the same regions and headings.
A screen reader landmark list for this file should offer banner, navigation, main, and contentinfo. The article heading is still reached by the heading list inside main.
Common Pitfalls & Security
Landmarks help only when they match the visual page and there is one obvious main. Wrapping everything in extra mains, or using a div because a framework component already has a class name, removes the jumps people rely on.
- More than one main element leaves assistive technology without a single primary region.
- A header that wraps the entire page, including the article, makes the banner include content that is not introductory.
- Links sitting in a paragraph with no nav are just links. They do not show up as a navigation landmark.
- Using a table or a pile of div elements for the banner, the article, and the footer paints a layout and skips the outline.
- Putting the aside outside the page with absolute positioning can hide it from the reading order if it is also removed from the tree. Keep it in the HTML where it belongs.
Best Practices & Modern Standards
HTML5 gives you header, nav, main, article, section, aside, and footer so a full page does not need a map made of div class names. Use each region for its meaning, give every section a heading, and keep one main. Let CSS, including a later flex or grid layout, move the aside beside the article without changing the elements.
When a page has two nav elements, give each a visible heading or an accessible name so the landmark list can tell them apart. That naming step belongs with ARIA, after the native regions are in place. Do not add role="navigation" to a nav. The element already has that role.
Real-World Use
The handbook chapter Writing pages people can scan is published with this landmark map. Students land in main, read the article, and check the aside for the file they must bring to the workshop. The same header and footer appear on the courses, labs, and faculty pages, so the landmark jumps stay in familiar places.
A department homepage can reuse the identical regions: header and nav for the school, main with an article for the announcement, an aside for dates, and a footer for contact details. The visual row of columns is a stylesheet concern. The HTML stays the landmark skeleton.
Frequently Asked Questions
Can header appear inside an article as well as at the top of the page?
Yes. A page has one banner header, and an article may have its own header for its title and byline. The sample keeps the title in the article without a nested header so the map stays easy to read. Add an article header when the byline should be grouped with the h1.
Does every section need a heading?
Yes. A section is a thematic grouping, and without a heading it is a div that happens to use a different tag. Pair each section with an h2 or a deeper heading that matches the outline. Do not use section only to apply a background color.
Where should aside sit in the source?
Put aside after the article inside main when the note is supporting material for that page. Source order is reading order for assistive technology and for a narrow screen with no layout CSS. Do not move the aside to the top of the HTML just to paint it on the right.
Is a div ever still appropriate?
Yes, when you need a wrapper that has no landmark meaning, such as a flex row around a group of cards that are already articles. Do not use a div for the banner, the primary navigation, the main content, or the footer. Those jobs already have elements.