BS5 Dropdowns
Bootstrap 5 Dropdowns
A dropdown menu is a toggleable menu that lets the user select one item from a list that has already been predetermined:
==== DROPDOWN BUTTON MUKAVU ====
Example
Example Explained
A dropdown menu is indicated by the .dropdown class.
You can use a button or a link with the class of to open the dropdown menu .dropdown-toggle and the attribute data-toggle=”dropdown”
To create the dropdown menu, add the .dropdown-menu class to a <div> element. Next, give each element (button or link) inside the dropdown menu the .dropdown-item class.
Dropdown Divider
==== DROPDOWN BUTTON MUKAVU ====
To add a thin horizontal border to links inside the dropdown menu, use the .dropdown-divider class:
Example
Dropdown Header
==== DROPDOWN BUTTON MUKAVU ====
Headers can be added to the dropdown menu using the .dropdown-header class:
Example
Dropdown header 1
Disable and Active items
==== DROPDOWN BUTTON MUKAVU ====
Use the .active class to draw attention to a particular dropdown item (adds a blue background color).
Utilize the .disabled class (which results in light-grey text and a “no-parking-sign” image when hovered over) to deactivate an option in the dropdown menu:
Example
Dropdown Position
==== DROPDOWN BUTTON MUKAVU ====
By giving the dropdown element the .dropright or .dropleft class, you may also make a “dropleft” or “dropright” menu. Be aware that the arrow and caret are added automatically:
Dropright
Dropleft
Dropdown Menu Right
==== DROPDOWN BUTTON MUKAVU ====
Add the .dropdown-menu-right class to the element that has the .dropdown-menu element to align the dropdown menu to the right:
Example
Dropup
==== DROPDOWN BUTTON MUKAVU ====
To enable upward expansion of the dropdown menu instead of downward expansion, modify the <div> element with class=”dropdown” to “dropup“:
Example
CodingAsk.com is designed for learning and practice. Examples may be made simpler to aid understanding. Tutorials, references, and examples are regularly checked for mistakes, but we cannot guarantee complete accuracy. By using CodingAsk.com, you agree to our terms of use, cookie, and privacy policy.
Copyright 2010-2024 by Refsnes Data. All Rights Reserved.