HTML Semantic Page Layout
Describe the regions of a page with header, nav, main, article, aside, and footer.
On this page
The concept
Semantic elements say what a region is, not how it looks. header introduces a page or section, nav holds navigation links, main wraps the unique content of the page, article is a self-contained piece, aside is related content, and footer closes a page or section. Browsers, search engines, and screen readers use these landmarks to help people jump around the page. Use div only when no semantic element fits.
Code example
<header>
<h1>Programonic</h1>
<nav aria-label="Main">
<a href="/tutorials">Tutorials</a>
<a href="/examples">Examples</a>
</nav>
</header>
<main>
<article>
<h2>Learning loops</h2>
<p>A loop repeats a block of code.</p>
</article>
<aside>
<h2>Related</h2>
<p>Functions and recursion.</p>
</aside>
</main>
<footer>
<p>© 2026 Programonic</p>
</footer>Follow the code
Open the walkthrough to inspect the example one step at a time.
Show guided walkthrough
<header> <h1>Programonic</h1> <nav aria-label="Main"> <a href="/tutorials">Tutorials</a> <a href="/examples">Examples</a> </nav></header><main> <article> <h2>Learning loops</h2> <p>A loop repeats a block of code.</p> </article> <aside> <h2>Related</h2> <p>Functions and recursion.</p> </aside></main><footer> <p>© 2026 Programonic</p></footer>Follow the example
Start to inspect the source, values, and output. These prepared steps explain the published sample; grouped loop steps describe multiple iterations.
View the complete dry-run table
| Step / line | What happens | State after step | Output so far |
|---|---|---|---|
| header introduces the page. Screen readers announce it as a banner landmark. | — | — | |
| nav marks a group of navigation links. The label tells assistive technology which navigation this is. | — | — | |
| main holds the content unique to this page. A page should have only one visible main element. | — | — | |
| article is a self-contained piece of content that makes sense on its own. | — | — | |
| aside is related but separate content, such as a sidebar. | — | — | |
| footer closes the page. The browser renders these elements; there is no console output. | — | — |
Behind the scenes
How HTML processes this code
The browser parses HTML into a document tree and renders its elements. HTML does not execute as a sequence of program statements.