Complete the code to create a navigation bar using the correct HTML element.
<[1]> <a href="#home">Home</a> <a href="#about">About</a> <a href="#contact">Contact</a> </[1]>
The <nav> element is used to define a block of navigation links. It helps browsers and assistive technologies understand the page structure.
Complete the code to add a navigation list inside the nav element.
<nav>
<ul>[1]</ul>
</nav>- without
- .
tags instead of list items.
Navigation links are often grouped inside an unordered list <ul> with each link inside a list item <li>. This helps screen readers and organizes the links clearly.
Fix the error in the navigation code by completing the blank with the correct attribute for links.
<nav>
<ul>
<li><a [1]>Home</a></li>
<li><a href="#about">About</a></li>
<li><a href="#contact">Contact</a></li>
</ul>
</nav>The href attribute specifies the link's destination. Using other attributes like src, link, or url will not work for anchor tags.
Fill both blanks to create a navigation bar with accessible labels and semantic structure.
<[1] aria-label="Main navigation"> <[2]> <li><a href="#home">Home</a></li> <li><a href="#services">Services</a></li> <li><a href="#contact">Contact</a></li> </[2]> </[1]>
- for the list of links.
The outer element should be <nav> for navigation. Inside it, the list of links should be inside an unordered list <ul>. The aria-label helps screen readers understand the navigation purpose.
Fill all three blanks to create a responsive navigation bar with semantic HTML and accessible links.
<[1] aria-label="Primary navigation"> <[2] class="menu"> <li><a href="#home" [3]>Home</a></li> <li><a href="#blog">Blog</a></li> <li><a href="#contact">Contact</a></li> </[2]> </[1]>
The navigation container is <nav>. The list of links is inside an unordered list <ul>. The aria-current="page" attribute marks the current page link for screen readers.