0
0
Bootsrapmarkup~10 mins

Dropdown directions (up, left, right) in Bootsrap - Interactive Code Practice

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

Complete the code to make the dropdown open upwards.

Bootsrap
<div class="dropdown drop[1]">
  <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>
</div>
Drag options to blanks, or click blank then click option'
Astart
Bend
Cup
Ddown
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'down' which is the default and does not change direction.
Confusing 'start' or 'end' which control horizontal alignment.
2fill in blank
medium

Complete the code to make the dropdown menu align to the left side of the button.

Bootsrap
<div class="dropdown">
  <button class="btn btn-primary dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false">
    Dropdown
  </button>
  <ul class="dropdown-menu dropdown-menu-[1]">
    <li><a class="dropdown-item" href="#">Item 1</a></li>
    <li><a class="dropdown-item" href="#">Item 2</a></li>
  </ul>
</div>
Drag options to blanks, or click blank then click option'
Astart
Bend
Cup
Ddown
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'dropdown-menu-end' which aligns the menu to the right.
Using 'down' or 'up' which control vertical direction, not horizontal alignment.
3fill in blank
hard

Fix the error in the code to make the dropdown open to the right side.

Bootsrap
<div class="dropdown drop[1]">
  <button class="btn btn-info dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false">
    Dropdown
  </button>
  <ul class="dropdown-menu">
    <li><a class="dropdown-item" href="#">Option A</a></li>
    <li><a class="dropdown-item" href="#">Option B</a></li>
  </ul>
</div>
Drag options to blanks, or click blank then click option'
Aleft
Bright
Cstart
Dend
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'dropright' which is not supported in Bootstrap 5.
Using 'dropleft' or 'dropstart' which open the dropdown to the left.
4fill in blank
hard

Fill both blanks to create a dropdown that opens upwards and aligns its menu to the right.

Bootsrap
<div class="dropdown [1]">
  <button class="btn btn-warning dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false">
    Dropdown
  </button>
  <ul class="dropdown-menu dropdown-menu-[2]">
    <li><a class="dropdown-item" href="#">First</a></li>
    <li><a class="dropdown-item" href="#">Second</a></li>
  </ul>
</div>
Drag options to blanks, or click blank then click option'
Adropup
Bstart
Cend
Ddropdown
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up 'start' and 'end' for horizontal alignment.
Using 'dropdown' class in place of direction classes.
5fill in blank
hard

Fill all three blanks to create a dropdown that opens to the left, with the menu aligned to the left, and uses a button with the 'btn-success' class.

Bootsrap
<div class="dropdown [1]">
  <button class="btn [2] dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false">
    Dropdown
  </button>
  <ul class="dropdown-menu dropdown-menu-[3]">
    <li><a class="dropdown-item" href="#">Alpha</a></li>
    <li><a class="dropdown-item" href="#">Beta</a></li>
  </ul>
</div>
Drag options to blanks, or click blank then click option'
Adropstart
Bbtn-success
Cstart
Dbtn-primary
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'dropend' instead of 'dropstart' for left direction.
Using 'btn-primary' instead of 'btn-success' for the button color.
Mixing up 'start' and 'end' for menu alignment.