Complete the code to create a navigation section using the correct HTML tag.
<[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 in HTML. It helps browsers and assistive technologies understand the page structure better.
Complete the code to add an accessible label to the navigation element.
<nav aria-[1]="main-nav"> <h2 id="main-nav">Main navigation</h2> <a href="#home">Home</a> <a href="#services">Services</a> <a href="#contact">Contact</a> </nav>
The aria-labelledby attribute is used to provide an accessible name for the navigation region by referencing an element that labels it. Alternatively, aria-label can be used for a direct label.
Fix the error in the navigation list by completing the missing tag.
<nav>
<ul>
<li><a href="#home">Home</a></li>
<li><a href="#about">About</a></li>
[1]<a href="#contact">Contact</a></li>
</ul>
</nav>- or
Each navigation link inside a list should be wrapped in a <li> (list item) tag. The missing opening <li> tag causes invalid HTML.
Fill both blanks to create a navigation with a heading and a list of links.
<nav aria-[1]="nav-heading"> <h2 id="nav-heading">[2]</h2> <ul> <li><a href="#home">Home</a></li> <li><a href="#blog">Blog</a></li> </ul> </nav>
The aria-labelledby attribute references the heading's id to label the navigation region. The heading text 'Navigation' describes the purpose of the links.
Fill all three blanks to create a responsive navigation with semantic HTML and accessible labeling.
<nav aria-[1]="main-nav"> <h2 id="main-nav">[2]</h2> <ul> <li><a href="[3]">Home</a></li> <li><a href="#services">Services</a></li> <li><a href="#contact">Contact</a></li> </ul> </nav>
The aria-labelledby attribute points to the heading with id 'main-nav' which contains the text 'Main Navigation'. The first link uses #home as the href to navigate to the home section.