Bird
Raised Fist0
Bootsrapmarkup~10 mins

Why navigation structure matters in Bootsrap - Test Your Understanding

Choose your learning style10 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to create a basic Bootstrap navigation bar.

Bootsrap
<nav class="navbar navbar-expand-lg navbar-light bg-light">
  <a class="navbar-brand" href="#">MySite</a>
  <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
    <span class="navbar-toggler-icon"></span>
  </button>
  <div class="collapse navbar-[1]" id="navbarNav">
    <ul class="navbar-nav">
      <li class="nav-item active">
        <a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a>
      </li>
    </ul>
  </div>
</nav>
Drag options to blanks, or click blank then click option'
Acollapse
Bshow
Cexpand
Dhidden
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'show' instead of 'collapse' causes the menu to always be visible.
Using 'expand' is not a valid Bootstrap class for this purpose.
2fill in blank
medium

Complete the code to add a navigation link with proper Bootstrap classes.

Bootsrap
<ul class="navbar-nav">
  <li class="nav-item">
    <a class="[1]" href="#about">About</a>
  </li>
</ul>
Drag options to blanks, or click blank then click option'
Anav-button
Bnavbar-brand
Cnav-link
Dnav-item
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'nav-item' on the anchor tag instead of the list item.
Using 'navbar-brand' for regular links.
3fill in blank
hard

Fix the error in the navigation bar code by completing the blank.

Bootsrap
<nav class="navbar navbar-expand-lg navbar-light bg-light">
  <a class="navbar-brand" href="#">Site</a>
  <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
    <span class="navbar-toggler-icon"></span>
  </button>
  <div class="collapse navbar-[1]" id="navbarNav">
    <ul class="navbar-nav">
      <li class="nav-item">
        <a class="nav-link" href="#services">Services</a>
      </li>
    </ul>
  </div>
</nav>
Drag options to blanks, or click blank then click option'
Ashow
Bcollapse
Chidden
Dexpand
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'show' causes the menu to be always visible.
Using 'expand' is not a valid class here.
4fill in blank
hard

Fill both blanks to create a responsive navigation bar that collapses on small screens and expands on large screens.

Bootsrap
<nav class="navbar navbar-[1]-lg navbar-light bg-light">
  <a class="navbar-brand" href="#">Brand</a>
  <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navMenu" aria-controls="navMenu" aria-expanded="false" aria-label="Toggle navigation">
    <span class="navbar-toggler-icon"></span>
  </button>
  <div class="collapse navbar-[2]" id="navMenu">
    <ul class="navbar-nav">
      <li class="nav-item">
        <a class="nav-link" href="#">Home</a>
      </li>
    </ul>
  </div>
</nav>
Drag options to blanks, or click blank then click option'
Aexpand
Bcollapse
Cshow
Dhidden
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'show' instead of 'collapse' causes menu to always show.
Using 'collapse' on navbar class is incorrect.
5fill in blank
hard

Fill all three blanks to create a navigation link that is active, accessible, and uses Bootstrap classes correctly.

Bootsrap
<li class="nav-item [1]">
  <a class="nav-link" href="#" aria-current="[2]">Home <span class="sr-only">[3]</span></a>
</li>
Drag options to blanks, or click blank then click option'
Aactive
Bpage
C(current)
Ddisabled
Attempts:
3 left
💡 Hint
Common Mistakes
Omitting 'aria-current' reduces accessibility.
Using 'disabled' class instead of 'active' changes the link behavior.

Practice

(1/5)
1. Why is having a clear navigation structure important in a Bootstrap website?
easy
A. It helps users find information quickly and easily.
B. It makes the website load faster.
C. It changes the website's color scheme automatically.
D. It hides content from users.

Solution

  1. Step 1: Understand the purpose of navigation

    Navigation is designed to guide users to different parts of a website efficiently.
  2. Step 2: Connect navigation clarity to user experience

    A clear navigation structure helps users find what they want without confusion or delay.
  3. Final Answer:

    It helps users find information quickly and easily. -> Option A
  4. Quick Check:

    Navigation clarity = helps users find info [OK]
Hint: Navigation guides users; clear means easy to find [OK]
Common Mistakes:
  • Thinking navigation affects page speed
  • Confusing navigation with styling
  • Assuming navigation hides content
2. Which Bootstrap class is used to create a responsive navigation bar?
easy
A. navbar-expand
B. btn-primary
C. card-body
D. form-control

Solution

  1. Step 1: Identify Bootstrap classes for navigation

    The class navbar-expand is used to make the navigation bar responsive.
  2. Step 2: Differentiate from other classes

    btn-primary styles buttons, card-body styles card content, and form-control styles form inputs.
  3. Final Answer:

    navbar-expand -> Option A
  4. Quick Check:

    Responsive navbar class = navbar-expand [OK]
Hint: Look for classes starting with 'navbar' for navigation [OK]
Common Mistakes:
  • Choosing button or form classes for navigation
  • Confusing card classes with navbar
  • Using incomplete class names
3. What will be the visual result of this Bootstrap navigation code?
<nav class="navbar navbar-expand-lg navbar-light bg-light">
  <a class="navbar-brand" href="#">MySite</a>
  <div class="collapse navbar-collapse" id="navbarNav">
    <ul class="navbar-nav">
      <li class="nav-item active"><a class="nav-link" href="#">Home</a></li>
      <li class="nav-item"><a class="nav-link" href="#">About</a></li>
    </ul>
  </div>
</nav>
medium
A. Only the brand name 'MySite' is visible, no links.
B. A vertical list of links without brand name.
C. A horizontal navigation bar with 'MySite' brand and two links: Home (highlighted) and About.
D. A button labeled 'Home' and a hidden About link.

Solution

  1. Step 1: Analyze the navbar classes

    The classes navbar-expand-lg and navbar-light bg-light create a horizontal light-colored navbar.
  2. Step 2: Check the content inside navbar

    The brand 'MySite' is shown on the left, and two links 'Home' (active) and 'About' appear horizontally.
  3. Final Answer:

    A horizontal navigation bar with 'MySite' brand and two links: Home (highlighted) and About. -> Option C
  4. Quick Check:

    Bootstrap navbar with brand and links = horizontal bar [OK]
Hint: Look for navbar-expand and nav-item classes for horizontal menu [OK]
Common Mistakes:
  • Thinking navbar is vertical by default
  • Missing the brand name display
  • Confusing active link styling
4. Identify the error in this Bootstrap navigation snippet:
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
  <ul class="navbar-nav">
    <li class="nav-item"><a class="nav-link" href="#">Home</a></li>
  </ul>
</nav>
medium
A. Incorrect use of nav-link class on anchor tag.
B. The bg-dark class cannot be used with navbar-dark.
C. The navbar-expand-lg class should be navbar-expand-sm.
D. Missing navbar-brand element for site name or logo.

Solution

  1. Step 1: Review Bootstrap navbar structure

    A typical navbar includes a navbar-brand for the site name or logo to identify the site.
  2. Step 2: Check the given code

    The code has no navbar-brand element, which reduces clarity and user orientation.
  3. Final Answer:

    Missing navbar-brand element for site name or logo. -> Option D
  4. Quick Check:

    Navbar-brand missing = navigation less clear [OK]
Hint: Always include navbar-brand for clear site identity [OK]
Common Mistakes:
  • Thinking nav-link is misused
  • Changing expand class unnecessarily
  • Believing bg-dark and navbar-dark conflict
5. You want to improve accessibility in your Bootstrap navigation bar. Which change best helps keyboard users navigate the menu?
hard
A. Use only colors to show which menu item is active.
B. Add aria-label to the nav element describing the menu purpose.
C. Remove all focus outlines to keep design clean.
D. Hide the navigation on small screens to reduce clutter.

Solution

  1. Step 1: Understand accessibility needs for navigation

    Keyboard users rely on clear labels and focus indicators to navigate menus.
  2. Step 2: Evaluate each option

    Adding aria-label helps screen readers describe the navigation. Using only colors or removing focus outlines harms accessibility. Hiding navigation removes access.
  3. Final Answer:

    Add aria-label to the nav element describing the menu purpose. -> Option B
  4. Quick Check:

    ARIA labels improve keyboard and screen reader navigation [OK]
Hint: Use ARIA labels to describe navigation for assistive tech [OK]
Common Mistakes:
  • Relying only on color for active states
  • Removing focus outlines which help keyboard users
  • Hiding navigation on small screens without alternatives
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard