Layout Elements
header, nav, main, footer, aside
Skills taught: html.layout, html.header, html.nav, html.main, html.footer, html.aside
A typical web page has recognisable regions. HTML5 gives each region a semantic element:
<!DOCTYPE html>
<html lang="en">
<head>
<title>My Website</title>
</head>
<body>
<header>
<a href="/"><img src="/logo.svg" alt="KERNAL"></a>
<nav aria-label="Main">
<ul>
<li><a href="/">Home</a></li>
<li><a href="/learn">Learn</a></li>
<li><a href="/about">About</a></li>
</ul>
</nav>
</header>
<main>
<h1>Welcome to KERNAL</h1>
<p>The core of every coder.</p>
</main>
<aside aria-label="Related courses">
<h2>Continue learning</h2>
<ul>
<li><a href="/learn/css">CSS</a></li>
</ul>
</aside>
<footer>
<p>© 2025 Dhurta.Org</p>
<nav aria-label="Footer">
<a href="/privacy">Privacy</a>
<a href="/terms">Terms</a>
</nav>
</footer>
</body>
</html>
- **header** — site logo, site title, top navigation. ARIA role: `banner`
- **nav** — navigation links. ARIA role: `navigation`. Label multiple navs with aria-label
- **main** — the unique content of the page (one per page). ARIA role: `main`
- **aside** — related but non-essential content (sidebar, related links). ARIA role: `complementary`
- **footer** — copyright, secondary links, contact info. ARIA role: `contentinfo`
Warning:
Tip:
Frequently Asked Questions
What is the difference between header and h1?
header is a structural container (a section of the page). h1 is a heading element (text that introduces content). A header typically contains an h1 plus navigation, logo, or other introductory content.
Can I use aside for a sidebar?
Yes — aside is perfect for sidebars that contain supplementary content (related articles, ads, author bios). The content should make sense even if removed from the main flow.
Should I replace all my divs with semantic elements?
Replace divs where a semantic element exists for that region (header, nav, main, footer, aside). Keep divs for purely layout or styling purposes where no semantic element fits — like a flex container or a CSS grid wrapper.