From the course: Bootstrap 4 Essential Training
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Add a dropdown to navigation - Bootstrap Tutorial
From the course: Bootstrap 4 Essential Training
Add a dropdown to navigation
- [Instructor] Although dropdowns are technically a separate component, they're used very often in menus. So I'm going to show you how to add them inside a menu element. So, a dropdown requires a container, just like a lot of other elements to work. And so, you'll need to create something that has a class of dropdown. This is usually a div, or it could be on a list item if you're using a navigation that uses list items. I personally prefer to do my navigation just with anchor tags, so I'm going to show you an example like that. And then, this container is used to align the dropdown to the proper item in the navigation. There's also a dropdown-toggle class, and that is added on the link in order to get a little triangle to indicate that this element has a dropdown in it. Now finally, dropdowns can be activated in one of two ways. You could do it through JavaScript or by using a data attribute, and this attribute is called data-toggle, and you set it to dropdown. Bootstrap currently…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.