07 Oct Bootstrap Dropdown
Learn how to create a Dropdown Menu in Bootstrap. With that learn the following in this lesson:
- Add header in Dropdown Menu
- Disable a dropdown menu item
- Separate links in a Dropdown Menu
- Create a Dropright menu
- Create a Dropleft menu
- Align the dropdown menu to the right
Example – Bootstrap Dropdown
Let us now see an example to create a dropdown menu in Bootstrap:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
<!DOCTYPE html> <html lang="en"> <head> <title>Bootstrap Dropdown Menu Example</title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet"> <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script> </head> <body> <div class="container"> <div class="dropdown"> <button type="button" class="btn btn-info dropdown-toggle" data-bs-toggle="dropdown"> Java </button> <div class="dropdown-menu"> <a class="dropdown-item" href="#">Core Java</a> <a class="dropdown-item" href="#">Advanced Java</a> </div> </div> </div> </body> </html> |
Output
Click the dropdown menu:
Video Tutorial – Bootstrap Dropdown
The following is the complete video tutorial to learn how to work with Dropdown in Bootstrap:
If you liked the tutorial, spread the word and share the link and our website Studyopedia with others.
Read More:
No Comments