0
0
Bootsrapmarkup~20 mins

Dropdown directions (up, left, right) in Bootsrap - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Dropdown Direction Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
rendering
intermediate
2:00remaining
Dropdown direction: Which class makes the dropdown open upwards?
Given a Bootstrap dropdown button, which class makes the dropdown menu open above the button instead of below?
Bootsrap
<button class="btn btn-secondary dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false">Dropdown</button><ul class="dropdown-menu"> <li><a class="dropdown-item" href="#">Action</a></li> <li><a class="dropdown-item" href="#">Another action</a></li> </ul>
AAdd class <code>drop-top</code> to the parent <code>div</code>
BAdd class <code>dropdown-menu-up</code> to the <code>ul</code> element
CAdd class <code>dropdown-top</code> to the button element
DAdd class <code>dropup</code> to the parent <code>div</code> wrapping the button and menu
Attempts:
2 left
💡 Hint
Bootstrap uses specific parent classes to control dropdown direction.
📝 Syntax
intermediate
2:00remaining
Correct class for left-aligned dropdown in Bootstrap
Which class correctly aligns the dropdown menu to the left side of the button in Bootstrap 5?
Bootsrap
<div class="dropdown"> <button class="btn btn-primary dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false">Menu</button> <ul class="dropdown-menu ???"> <li><a class="dropdown-item" href="#">Item 1</a></li> <li><a class="dropdown-item" href="#">Item 2</a></li> </ul> </div>
Adropdown-menu-start
Bdropdown-menu-left
Cdropdown-menu-align-left
Ddropdown-menu-leftside
Attempts:
2 left
💡 Hint
Bootstrap 5 uses directional suffixes like '-start' and '-end' for alignment.
🧠 Conceptual
advanced
2:00remaining
What happens if you add both dropup and dropdown-menu-end classes?
If you add dropup to the dropdown container and dropdown-menu-end to the menu, how will the dropdown behave?
Bootsrap
<div class="dropup"> <button class="btn btn-secondary dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false">Options</button> <ul class="dropdown-menu dropdown-menu-end"> <li><a class="dropdown-item" href="#">First</a></li> <li><a class="dropdown-item" href="#">Second</a></li> </ul> </div>
AThe menu opens upwards and aligns to the right side of the button
BThe menu opens downwards and aligns to the left side of the button
CThe menu opens upwards but aligns to the left side ignoring dropdown-menu-end
DThe menu does not open due to conflicting classes
Attempts:
2 left
💡 Hint
dropup controls vertical direction; dropdown-menu-end controls horizontal alignment.
accessibility
advanced
2:00remaining
Which attribute improves accessibility for dropdown toggle buttons?
To make a dropdown toggle button accessible, which ARIA attribute should you include?
Bootsrap
<button class="btn btn-primary dropdown-toggle" type="button" data-bs-toggle="dropdown">Toggle</button>
Aaria-label="dropdown-toggle"
Baria-expanded="false"
Caria-pressed="true"
Daria-hidden="true"
Attempts:
2 left
💡 Hint
This attribute tells screen readers if the dropdown is open or closed.
selector
expert
3:00remaining
CSS selector to style only dropdown menus opening to the right
Which CSS selector targets only dropdown menus that open to the right side using Bootstrap classes?
A.dropdown-menu.dropdown-menu-right
B.dropdown-menu.dropdown-menu-end
C.dropend .dropdown-menu
D.dropdown-menu.drop-right
Attempts:
2 left
💡 Hint
Bootstrap uses specific parent classes to control dropdown direction, not just menu classes.