HTML Reference
<aside> & <nav> — Complementary and Navigation
Two landmark elements that guide users and screen readers through a page.
Last updated: October 2026
Definition: The <nav> element defines a section of navigation links. It is a landmark — screen readers can jump directly to it. The <aside> element is for content tangentially related to the main content — sidebars, related posts, or pull quotes. Both are semantic improvements over <div>.
🎬 Live Example
A typical blog layout — nav at the top, aside on the side, main content in the middle.
💡 Each element is a landmark. Screen readers can jump directly to nav or aside.
Basic Syntax
<!-- Navigation -->
<nav>
<ul>
<li><a href="/">Home</a></li>
<li><a href="/blog">Blog</a></li>
<li><a href="/about">About</a></li>
</ul>
</nav>
<!-- Aside (sidebar) -->
<aside>
<h2>Related Posts</h2>
<ul>
<li><a href="/post-1">Post 1</a></li>
<li><a href="/post-2">Post 2</a></li>
</ul>
</aside>
⚙️ Attributes Reference
Both elements have no specific attributes. They use the standard global attributes:
| Attribute | Purpose |
|---|---|
id | Unique identifier for anchors and JavaScript. |
class | Styling classes. |
aria-label | When multiple navs exist, label each one. Example: aria-label="Main navigation". |
aria-labelledby | Point to a heading ID to label the landmark. |
nav — What Belongs Inside
Wrap navigation links in a <nav> and typically inside a <ul>.
<!-- Primary site navigation -->
<nav aria-label="Main">
<ul>
<li><a href="/">Home</a></li>
<li><a href="/courses">Courses</a></li>
<li><a href="/blog">Blog</a></li>
<li><a href="/contact">Contact</a></li>
</ul>
</nav>
<!-- Breadcrumb navigation -->
<nav aria-label="Breadcrumb">
<ol>
<li><a href="/">Home</a></li>
<li><a href="/courses">Courses</a></li>
<li><a href="/courses/html">HTML</a></li>
</ol>
</nav>
<!-- Table of contents -->
<nav aria-label="Table of contents">
<ul>
<li><a href="#intro">Introduction</a></li>
<li><a href="#setup">Setup</a></li>
<li><a href="#usage">Usage</a></li>
</ul>
</nav>
What Does NOT Belong in nav
Not every group of links is navigation. Wrapping social media icons or related article links in <nav> is a common mistake.
Do NOT wrap in <nav>:
- Social media icons in the footer
- Related posts at the bottom of an article
- Inline links inside a paragraph
- Tag lists or category lists
- Footer legal links (Privacy, Terms)
These are lists or groups of links, not navigation. Use <ul> or a <div> with a heading instead.
aside — Tangential Content
Use <aside> for content that is related to the main topic but not essential to it.
<!-- Sidebar with related links -->
<aside>
<h2>Related Posts</h2>
<ul>
<li><a href="/html-semantic">Understanding Semantic HTML</a></li>
<li><a href="/css-grid">CSS Grid Basics</a></li>
</ul>
</aside>
<!-- Pull quote inside an article -->
<article>
<p>The main article content...</p>
<aside>
<p>"Semantic HTML is not optional — it is the foundation of accessible web design."</p>
</aside>
<p>More content...</p>
</article>
<!-- Advertisement -->
<aside aria-label="Advertisement">
<div class="ad-slot">...</div>
</aside>
<!-- Author bio at the end of a blog post -->
<article>
<p>...article content...</p>
<aside class="author-bio">
<h3>About the Author</h3>
<p>Jane Doe is a developer...</p>
</aside>
</article>
Multiple navs on One Page
A page can have multiple <nav> elements. Label each one with aria-label so screen readers can distinguish them.
<body>
<!-- 1. Primary site navigation -->
<nav aria-label="Main">...</nav>
<!-- 2. Breadcrumb -->
<nav aria-label="Breadcrumb">...</nav>
<main>
<!-- 3. Table of contents in the sidebar -->
<aside>
<nav aria-label="Table of contents">...</nav>
</aside>
</main>
<!-- 4. Footer navigation -->
<footer>
<nav aria-label="Footer">...</nav>
</footer>
</body>
Accessible Navigation Menu
A complete accessible navigation pattern — the toggle uses ARIA attributes.
<nav aria-label="Main">
<button
aria-expanded="false"
aria-controls="main-menu"
class="menu-toggle">
☰ Menu
</button>
<ul id="main-menu">
<li><a href="/">Home</a></li>
<li><a href="/courses">Courses</a></li>
<li><a href="/blog">Blog</a></li>
<li><a href="/contact">Contact</a></li>
</ul>
</nav>
<script>
const toggle = document.querySelector(".menu-toggle");
const menu = document.getElementById("main-menu");
toggle.addEventListener("click", () => {
const expanded = toggle.getAttribute("aria-expanded") === "true";
toggle.setAttribute("aria-expanded", !expanded);
menu.hidden = expanded;
});
</script>
💡 Why aria-expanded matters: Screen readers announce the menu state ("collapsed" or "expanded"), so users know what the button will do.
🎯 nav & aside vs div
| Content | Element |
|---|---|
| Primary site navigation | <nav> |
| Breadcrumb trail | <nav> |
| Table of contents | <nav> |
| Sidebar with related links | <aside> |
| Pull quote | <aside> |
| Advertisement | <aside> |
| Author bio | <aside> |
| Footer social icons | <ul> |
| Tag list | <ul> |
| Nothing fits | <div> |
⚠️ Common Mistakes
- Wrapping every link list in
<nav>. Social icons and tag lists are not navigation. Use<ul>. - Missing
aria-labelon multiple navs. Screen readers announce all of them as "navigation." Users can't tell them apart. - Putting page content in
<aside>. Aside content must be tangential. If it's essential to understanding, it belongs in<main>. - Using
<aside>for layout only. If a column has no semantic relationship, use<div>. - Nesting
<nav>inside another<nav>. Rarely useful and confusing. Use a single nav with a nested list. - Forgetting the toggle's
aria-expandedstate. Screen reader users can't tell if the menu is open or closed. - Using
<nav>without any links. A nav with a single link or no links is meaningless. - Not testing keyboard navigation. Tab through the menu. Focus must be visible and the order must match the visual layout.
♿ Accessibility Notes
- nav and aside are landmarks. Screen readers can jump directly to them. This is a huge time-saver for users.
- Label multiple navs with
aria-label. "Main navigation," "Breadcrumb," "Footer navigation." - Each landmark should be unique. Two navs with the same label are confusing.
- Skip links pair with nav. Add a "Skip to main content" link at the very top of the page, before the nav, so keyboard users can bypass the menu.
- Mobile menu buttons need
aria-expanded. This communicates the menu state to screen readers. - Breadcrumbs help orientation. Users understand where they are in the site hierarchy — a critical navigation aid.
- Related links in aside should be labeled. Give the aside a heading like "Related posts" so users know what they're looking at.
❓ Frequently Asked Questions
What is the HTML <nav> tag?
The <nav> element defines a section of navigation links. It is a landmark that screen readers can jump to. Use it for primary navigation, breadcrumbs, and table-of-contents — but not for every group of links on a page.
What is the HTML <aside> tag?
The <aside> element is for content tangentially related to the main content. Sidebars, pull quotes, related posts, and advertisements are common uses. Screen readers announce it as a complementary landmark.
How many nav elements can a page have?
There is no limit, but the practical number is 1 to 3. Common patterns: primary navigation (top), secondary navigation (sidebar), and a footer navigation. More than three becomes confusing.
Should I use nav for social media links?
Usually no. Social media icons in a footer are not primary navigation. Screen readers announce them as a navigation landmark, which is confusing. Use a plain list or a div with a heading instead.
What is the difference between nav and a list of links?
nav is a landmark that helps screen readers skip to navigation. A plain list is just a list. Use nav for the primary navigation and site-wide menus. Use a plain list for related links, tags, or inline link groups.