Build a navigation menu
Task
Build a horizontal site navigation menu with four links, wrapped in the semantic <nav> element.
Requirements
- Uses the <nav> element
- Links are structured as a <ul><li> list
- Each item contains an <a href="...">
- One link points to the home page (href="/")
Starter code
<nav>
</nav>
▶ Open in HTML Editor Hints
- A list inside navigation is standard practice: browsers and screen readers expect it.
- href="#" works fine as a placeholder link for pages that don't exist yet.
Show solution
<nav>
<ul>
<li><a href="/">Home</a></li>
<li><a href="/about">About</a></li>
<li><a href="/services">Services</a></li>
<li><a href="/contact">Contact</a></li>
</ul>
</nav>
Related tools
Flexbox: header menu and a row of cards
Flexbox practice exercise: put the logo and menu side by side in the header and line course cards up in an equal-height row that wraps on narrow screens.
HTML Editor Online
Write HTML with syntax highlighting and line numbers, see a live preview, format or minify it, and open or save .html files — all in your browser.
Links
Lesson 4: how to create links with <a> and href — to another page, to a section via #id, or to an external site in a new tab. Task and exercises.
The <nav> tag
Purpose of <nav>: grouping a page's primary navigation links.