Start learning with our library of video tutorials taught by experts. Get started
Viewed by members. in countries. members currently watching.
But a popular approach these days is to include dropdowns, and I get requested to teach how to make dropdowns all the time. Well, finally, I'm going to show you how to do it. Dropdowns are very easy to add here within Bootstrap, and I'm going to walk you through how we might go about doing that now. So down here in Dreamweaver, I've added a bit of code to this particular page. So here is the link for schedule. Notice that starts with an li then we have our a tag with the /a.
But the closing li doesn't occur until down here. Remember that these lists are actually nested within the li. That is the correct way to mark them up. So we have our ul here inside of that li with a /ul down here, and I have three bullets inside of that. What I'd like to do is have this become a dropdown menu. So let's take a look at where we are at this particular point. If you just open that document and then take a look at it inside of Firefox, you'll notice that we have indeed a bulleted list that appears right under the word schedule, which is great.
So we've added a class of dropdown-toggle and a data-toggle of dropdown to that a tag that's associated with the word schedule. Finally, what I want to do is add to the ul a class of dropdown-menu which is going to give me some styling here for the dropdown menu. So if you go ahead and save that--Ctrl+S or Command+S to save--Refresh the page inside of Firefox. Now you see that we have a navigation bar.
When I move my mouse over schedule and I click, you'll notice that I get a dropdown menu. So there's Day One, Day Two, and Day Three, and all these are clickable and will take you to those particular pages. How did I know that schedule was the one that had the dropdown menu? Well, I knew because I coded it. But how is a visitor of my web page going to know that schedule is the dropdown menu? An excellent question. It's likely that a visitor isn't going to know that that's a dropdown menu. So we should probably indicate somehow that schedule has got more behind it than just a single link.
So here back within Dreamweaver, we can add some additional code which will give us a little triangle that will appear right next to that word schedule that would indicate that a dropdown menu is located there. So right here after the word schedule, before the /a, go ahead and put in a span class of caret immediately followed by a /span. This little bit of code is going to put in that tiny little triangle arrow that would indicate that the dropdown lives right there.
Save your page, Ctrl+S or Command+S, refresh the page inside of Firefox, and now the word schedule has the little triangle right next to it, which would indicate that if you click on that you now have some additional options to explore. So dropdowns are pretty straightforward to add to our navigation toolbar. Actually, they're pretty easy to add to tabs and pills as well. I'll show you how to do that in the next video.
Find answers to the most frequently asked questions about Up and Running with Bootstrap 2.
Here are the FAQs that matched your search "":
Sorry, there are no matches for your search ""—to search again, type in another word or phrase and click search.
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.