0
0
Bootsrapmarkup~20 mins

Dropdown menu alignment in Bootsrap - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Dropdown Alignment Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
1:00remaining
How does Bootstrap align dropdown menus by default?
In Bootstrap, when you create a dropdown menu, where is the menu aligned relative to the toggle button by default?
AThe dropdown menu is aligned to the right edge of the toggle button.
BThe dropdown menu appears above the toggle button.
CThe dropdown menu is centered below the toggle button.
DThe dropdown menu is aligned to the left edge of the toggle button.
Attempts:
2 left
💡 Hint
Think about the default position of dropdown menus in most websites using Bootstrap.
📝 Syntax
intermediate
1:00remaining
Which class aligns a Bootstrap dropdown menu to the right?
You want your dropdown menu to open aligned to the right edge of the toggle button. Which Bootstrap class should you add to the dropdown menu element?
Adropdown-menu-right-align
Bdropdown-menu-end
Cdropdown-menu-align-right
Ddropdown-menu-right
Attempts:
2 left
💡 Hint
Bootstrap 5 uses a new naming convention for alignment classes.
rendering
advanced
1:30remaining
What is the visual result of this Bootstrap dropdown code?
Consider this HTML snippet using Bootstrap 5:
<div class="dropdown">
  <button class="btn btn-secondary dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false">
    Menu
  </button>
  <ul class="dropdown-menu dropdown-menu-end">
    <li><a class="dropdown-item" href="#">Action</a></li>
    <li><a class="dropdown-item" href="#">Another action</a></li>
  </ul>
</div>

Where will the dropdown menu appear relative to the button when clicked?
Bootsrap
<div class="dropdown">
  <button class="btn btn-secondary dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false">
    Menu
  </button>
  <ul class="dropdown-menu dropdown-menu-end">
    <li><a class="dropdown-item" href="#">Action</a></li>
    <li><a class="dropdown-item" href="#">Another action</a></li>
  </ul>
</div>
AThe menu opens below the button, aligned to the right edge.
BThe menu opens above the button, centered.
CThe menu opens below the button, aligned to the left edge.
DThe menu opens above the button, aligned to the right edge.
Attempts:
2 left
💡 Hint
Look at the class 'dropdown-menu-end' on the <ul> element.
selector
advanced
1:30remaining
Which CSS selector targets only right-aligned Bootstrap dropdown menus?
You want to write custom CSS that styles only Bootstrap dropdown menus aligned to the right. Which selector correctly targets these menus?
A.dropdown-menu.dropdown-menu-end
B.dropdown-menu-right
C.dropdown > .dropdown-menu-end
D.dropdown-menu-end > .dropdown-menu
Attempts:
2 left
💡 Hint
Bootstrap adds the class 'dropdown-menu-end' to right-aligned menus.
accessibility
expert
2:00remaining
What ARIA attribute ensures screen readers announce dropdown menu state correctly?
In Bootstrap dropdowns, which ARIA attribute on the toggle button updates to reflect whether the dropdown menu is open or closed?
Aaria-haspopup
Baria-controls
Caria-expanded
Daria-pressed
Attempts:
2 left
💡 Hint
This attribute is a boolean that changes from false to true when the menu opens.