Challenge - 5 Problems
Dropdown Alignment Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate1: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?
Attempts:
2 left
💡 Hint
Think about the default position of dropdown menus in most websites using Bootstrap.
✗ Incorrect
By default, Bootstrap aligns dropdown menus so their left edge matches the left edge of the toggle button. This means the menu opens downward and left-aligned.
📝 Syntax
intermediate1: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?
Attempts:
2 left
💡 Hint
Bootstrap 5 uses a new naming convention for alignment classes.
✗ Incorrect
In Bootstrap 5, the class dropdown-menu-end aligns the dropdown menu to the right edge of its parent toggle button.
❓ rendering
advanced1:30remaining
What is the visual result of this Bootstrap dropdown code?
Consider this HTML snippet using Bootstrap 5:
Where will the dropdown menu appear relative to the button when clicked?
<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>
Attempts:
2 left
💡 Hint
Look at the class 'dropdown-menu-end' on the <ul> element.
✗ Incorrect
The class dropdown-menu-end makes the dropdown menu open below the button but aligned to the right edge.
❓ selector
advanced1: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?
Attempts:
2 left
💡 Hint
Bootstrap adds the class 'dropdown-menu-end' to right-aligned menus.
✗ Incorrect
The selector .dropdown-menu.dropdown-menu-end targets elements with both classes, which are the right-aligned dropdown menus.
❓ accessibility
expert2: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?
Attempts:
2 left
💡 Hint
This attribute is a boolean that changes from false to true when the menu opens.
✗ Incorrect
The aria-expanded attribute on the toggle button changes dynamically to indicate if the dropdown menu is open (true) or closed (false), helping screen readers understand the state.