Navigation Menus
<nav>, <ul>, and <a> into the real-world navigation bar pattern used on almost every website, plus marking the current page for accessibility.
The Standard Nav Pattern
A navigation menu is semantically a list of links, wrapped in a <nav> landmark element so assistive technology can identify it as navigation and let users jump straight to it.
<nav> <ul> <li><a href="/">Home</a></li> <li><a href="/about.html">About</a></li> <li><a href="/contact.html">Contact</a></li> </ul> </nav>
CSS then removes the bullets and lays the items out horizontally with display: flex — the semantic structure (a real list) stays intact underneath the visual styling.
Marking the Current Page
Use aria-current="page" on the link matching the current page. This tells screen readers which nav item is active — don't rely on color alone, since that provides no information to non-sighted users.
<nav> <ul> <li><a href="/">Home</a></li> <li><a href="/about.html" aria-current="page">About</a></li> <li><a href="/contact.html">Contact</a></li> </ul> </nav> <!-- CSS can then target it visually too --> <style> a[aria-current="page"] { font-weight: 700; border-bottom: 2px solid; } </style>
Multiple Nav Landmarks
A page can have more than one <nav> — a main header nav, a footer nav, and a sidebar table-of-contents nav. When there's more than one, label each with aria-label so screen reader users can tell them apart.
<nav aria-label="Main"> <ul>...</ul> </nav> <nav aria-label="Footer"> <ul>...</ul> </nav>
Skip Links for Keyboard Users
A "skip to main content" link, hidden visually but focusable by keyboard, lets keyboard/screen-reader users bypass a long nav menu instead of tabbing through every link on every page.
<body> <a href="#main" class="skip-link">Skip to main content</a> <nav>...</nav> <main id="main">...</main> </body> <style> .skip-link { position: absolute; left: -9999px; } .skip-link:focus { left: 1rem; top: 1rem; } /* visible when tabbed to */ </style>
1. Build a <nav aria-label="Main"> with 4 links: Home, Courses, Blog, Contact.
2. Mark "Courses" as the current page using aria-current="page".
3. Add a hidden skip link before the nav that jumps to "#main".
💡 Show hints if you're stuck
- Structure:
<nav aria-label="Main"><ul><li><a>...</a></li></ul></nav> - Skip link goes right after <body>, before <nav>