Complete the code to add the Bootstrap class that makes the navbar responsive and collapsible.
<nav class="navbar navbar-expand-[1] bg-light"> <div class="container-fluid"> <a class="navbar-brand" href="#">Brand</a> </div> </nav>
The class navbar-expand-lg makes the navbar expand on large screens and collapse on smaller ones.
Complete the code to add the button that toggles the navbar collapse on small screens.
<button class="navbar-toggler" type="button" data-bs-toggle="[1]" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation"> <span class="navbar-toggler-icon"></span> </button>
The data-bs-toggle="collapse" attribute tells Bootstrap to toggle the collapse behavior for the navbar.
Fix the error in the navbar collapse container's id attribute to match the toggle button's target.
<div class="collapse navbar-collapse" id="[1]"> <ul class="navbar-nav me-auto mb-2 mb-lg-0"> <li class="nav-item"> <a class="nav-link active" aria-current="page" href="#">Home</a> </li> </ul> </div>
The id must match the data-bs-target value in the toggle button for the collapse to work.
Fill both blanks to complete the navbar list item with a link that is accessible and styled correctly.
<li class="nav-item"> <a class="nav-link [1]" aria-current="[2]" href="#">About</a> </li>
The class active highlights the current page link, and aria-current="page" helps screen readers know this is the current page.
Fill all three blanks to complete the responsive navbar with a brand, toggle button, and collapsible menu.
<nav class="navbar navbar-expand-[1] bg-light"> <div class="container-fluid"> <a class="navbar-brand" href="#">MySite</a> <button class="navbar-toggler" type="button" data-bs-toggle="[2]" data-bs-target="#navbarContent" aria-controls="navbarContent" aria-expanded="false" aria-label="Toggle navigation"> <span class="navbar-toggler-icon"></span> </button> <div class="collapse navbar-collapse" id="[3]"> <ul class="navbar-nav me-auto mb-2 mb-lg-0"> <li class="nav-item"> <a class="nav-link active" aria-current="page" href="#">Home</a> </li> </ul> </div> </div> </nav>
The navbar expands on large screens (lg), the toggle button uses collapse to show/hide the menu, and the collapsible menu's id navbarContent matches the toggle button's target.