Bootstrap 3 Tutorial
A dropdown menu is a toggleable menu that allows the user to select one item from a predetermined list.
The .dropdown class represents a dropdown menu.
To display the dropdown menu, use a button or link with the class of .dropdown-toggle and data-toggle=”dropdown” attributes.
The .caret class adds a caret arrow icon (), indicating that the button is a dropdown.
To create the dropdown menu, add the .dropdown-menu class to the <ul> element.
The .divider class is used to separate links within the dropdown menu with a thin horizontal border.
The .dropdown-header class is used to add headers within the dropdown menu.
Dropdown header 1
Use the .active class to highlight a certain dropdown item (a blue background color is added).
To deactivate an item in the dropdown menu, use the .disabled class (which has a light-grey text color and a “no-parking-sign” image when hovered):
To right-align the dropdown, apply the .dropdown-menu-right class to the element with .dropdown-menu:
To make the dropdown menu extend upwards instead of downwards, modify the <div> element with class=”dropdown” to “dropup“:
To increase accessibility for persons using screen readers, you should include the following role and aria-* attributes when building a dropdown menu:
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.