HTML Page Landmarks: Header, Main and Footer
Separate the major page regions
Use header for introductory or navigational content, main for the dominant content, and footer for information about its nearest relevant section or page. In a simple document these elements can be direct children of body. The page-level header and footer expose banner and contentinfo landmarks; main exposes a main landmark. Landmarks help assistive technology users navigate regions.
<header> <p>City library</p></header><main> <h1>Opening hours</h1> <p>Monday to Friday</p></main><footer> <p>Library information desk</p></footer>Three page regions separate shared content from the page topic.
Keep a single active main
A conforming document has at most one main without the hidden attribute. Keep repeated site navigation and site-wide footer information outside main. Do not nest main in header, footer, nav, article or aside. The site title need not be the main content heading.
<header> <p>Library</p> <nav aria-label="Primary"> <a href="#hours">Hours</a> </nav></header><main id="hours"> <h1>Today at the library</h1> <p>Open until 6 PM.</p></main><footer> <p>Contact the library desk.</p></footer>The navigation is outside the main content and points to an existing ID.
Distinguish local headers and footers
A header or footer inside an article can describe that article instead of the whole page. The article is a self-contained composition; the next lesson explains it in detail. Local header and footer elements do not expose the page banner and contentinfo landmarks in this context. These elements do not require specific visual positions.
<main> <article> <header> <h1>Library renovation</h1> <p>News desk</p> </header> <p>The reading room opens on Tuesday.</p> <footer> <p>Filed under local news.</p> </footer> </article></main>The article has its own introduction and footer, without extra page-level landmarks.
Common mistakes and practice
Use one visible main for the page. Do not add redundant role="main" to main or assume every header is a banner. Check the landmark list in browser accessibility tools.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
HTML Page Landmarks: Header, Main and Footer — Knowledge Check
Apply the semantic HTML and page structure concepts from this lesson.
How many main elements without hidden may a conforming document have?
What landmark does a direct body header normally expose?
A footer inside an article describes what in this context?
A header is inside an article. Should it be assumed to create a page banner?
Which region contains the dominant content of the current page?