📖 Scenario: You are building a website header that includes a navigation bar. This bar will help users move between different pages of the site easily.
🎯 Goal: Build a navigation bar using the element with three links: Home, About, and Contact.
📋 What You'll Learn
Use the semantic
Include three links with exact text: Home, About, Contact.
Each link should have an href attribute with values: '/', '/about', '/contact' respectively.
Use an unordered list
inside the
Ensure the HTML includes a and section for semantic structure.
💡 Why This Matters
🌍 Real World
Navigation bars help users move around websites easily. Using semantic tags and accessibility features makes your site friendly for everyone.
💼 Career
Web developers often build navigation menus. Knowing semantic HTML and accessibility is essential for professional web development.
Progress0 / 4 steps
1
Create the basic HTML structure
Write the basic HTML5 skeleton with , including and My Website, and containing an empty and element.
HTML
Hint
Start with the basic HTML5 page structure including , , and . Add empty and tags inside the body.
2
Add the <nav> element inside the header
Inside the existing , add a
HTML
Hint
Place the
3
Add an unordered list with three links inside <nav>
A. The first list item 'Home' is missing a link (<a> tag)
B. The <nav> element cannot contain <ul>
C. The <li> tags are not allowed inside <nav>
D. The href attribute is missing in the second link
Solution
Step 1: Check each list item content
The first <li> contains plain text 'Home' without a clickable link.
Step 2: Confirm proper link usage
Navigation items should be links (<a> tags) for accessibility and functionality.
Final Answer:
The first list item 'Home' is missing a link (<a> tag) -> Option A
Quick Check:
All nav items need <a> tags [OK]
Hint: Every nav item should be a link inside <li> [OK]
Common Mistakes:
Leaving text without <a> inside <li>
Thinking <nav> disallows <ul> or <li>
Ignoring missing href attributes
5. You want to create a navigation menu inside a website header that is accessible and clearly identified by screen readers. Which is the best way to use the <nav> element?