From the course: Bootstrap 3 Essential Training

Unlock the full course today

Join today to access over 22,500 courses taught by industry experts or purchase this course individually.

Creating a dropdown

Creating a dropdown - Bootstrap Tutorial

From the course: Bootstrap 3 Essential Training

Start my 1-month free trial

Creating a dropdown

- Dropdowns are the first element we're going to look at that require JavaScript. Now it's a very handy way to condense a lot of information into a very small space. So to show you how they work I'm starting out with a simple button, as well as an unordered list, and this will eventually become the dropdown. So the first step is to wrap both the button and the list with a DIV that has a class of dropdown. So I'll do that right here. And then I'm going to grab my button and my list and just paste it inside there. Next I'm going to add the data toggle equals dropdown attribute to the button. The data attribute is a special HTML class that allows you to enter your own data into any particular element. This data toggle isn't really an HTML five attribute, but whenever you want to insert your own attributes into an element, you simply put in data dash and then whatever name you want to use and it's a perfectly valid HTML five way of adding information to your element. So the JavaScript…

Contents