New Feature: Playlist Center! Pick a topic and let our playlists guide the way.

Start learning with our library of video tutorials taught by experts. Get started

Up and Running with Bootstrap 2
Illustration by

Using tabs and pills navigation


From:

Up and Running with Bootstrap 2

with Jen Kramer

Video: Using tabs and pills navigation

Over the next few videos, we're going to take a look at the simple bulleted list here and a number of different ways that we can change the classes to make this list look very, very different inside of Bootstrap. So, right now I'm taking a look at pills here. We're going to take a look at pills and tabs. Tabs you're probably familiar with, and pills are sort of round, oval sort of shapes. They have curved edges that you can also use to make very interesting looking navigation bars. What we have right now is our default markup, though, isn't terribly interesting.

Watch this entire course now—plus get access to every course in the library. Each course includes high-quality videos taught by expert instructors.

Become a member
please wait ...
Up and Running with Bootstrap 2
2h 38m Beginner Oct 12, 2012

Viewers: in countries Watching now:

Bootstrap is a free web development tool from Twitter that, with a little bit of CSS and JavaScript experience, makes building websites quick, intuitive, and fun. Author Jen Kramer explores its 12-column grid layout; typography and icon libraries; fully functional components like nav bars, buttons, and tabs; and much more. This course also shows how to add JavaScript extras like dropdown menus, modal windows, and photo carousels.

Topics include:
  • Understanding the difference between default and fluid grids
  • Nesting with fluid grids
  • Creating a thumbnail gallery
  • Adding block quotes and lists of text
  • Incorporating images and icons
  • Adding breadcrumb navigation and pagination
  • Using tabs and pills navigation
  • Making the nav bar responsive with JavaScript
  • Adding dropdown menus to the nav bar, tabs, and pill
Subjects:
Web Responsive Design Web Design Web Development
Software:
Bootstrap
Author:
Jen Kramer

Using tabs and pills navigation

Over the next few videos, we're going to take a look at the simple bulleted list here and a number of different ways that we can change the classes to make this list look very, very different inside of Bootstrap. So, right now I'm taking a look at pills here. We're going to take a look at pills and tabs. Tabs you're probably familiar with, and pills are sort of round, oval sort of shapes. They have curved edges that you can also use to make very interesting looking navigation bars. What we have right now is our default markup, though, isn't terribly interesting.

If I very quickly look at this inside of Firefox, you'll see that what you got is your basic bulleted list, very functional, not terribly pretty. So let's start adding some classes to see how we can make this look a little bit more attractive or a little bit different. So inside of Dreamweaver, the very first step is to add a class of nav. This is the most basic markup. Just by adding this nav you've indicated that this is navigation and some basic things are going to happen here.

So when I refresh you'll see that the margin and padding associated with ul has gone away, you'll see that the bullets have gone away, and we're now crammed into the side of the web page. The reason we're crammed into the side of the web page is because I'm not making use of the Bootstrap's Scaffolding system at this point. I've kept my markup very, very simple, the nav tag is located inside of the body tag, it's being pushed all the way out to the very edges of the web page. If I had this nav tag located somewhere else inside of the Bootstrap Scaffolding, this navigation would not look like it's a crammed into the edge.

So as you roll your mouse over these, you can see that there's a nice hover state that goes down these quite lovely. The reason that that hover state goes all the way across the page is because that's how wide the containing element for these particular links is. If you use the Scaffolding system, of course, this could be potentially quite narrower, depending on which of the span classes you choose to put your navigation list in. All right, so that's it, very, very basic, the first step of styling. Now let's add something to make it a little bit more interesting.

If I add nav-tabs, this will of course create more of a very tabbed type of look. It'll make our links go horizontal instead of vertical as well. So if I Refresh my page in Firefox, you'll see that that has in fact happened. We have a series of links here with a line underneath, and everything is looking great, but it doesn't really look like tabs yet. And the reason it doesn't look like tabs is because I haven't indicated what page I'm on. What page is the active page? There is that active class again, so let's say I'm on The Art page, so if I put in a class of active right here inside of my li and save that one more time and put that in Firefox, you'll see that we have a very nice looking tab right here. Of course, I can put some content underneath of this, and then it would be really obvious where I was.

So, that is tabs, and they're most simple structure. Make sure that you have an active state so that the tab meme is a little bit more obvious on the page. Now you might be wondering what else could you do with this type of tab styling? There is another class that makes things go vertical. So what would happen if we took this tab styling, and we actually made it go vertical? Well, it's a little bit surprising. So after nav tabs, if you add nav-stacked and save that page one more time, Refresh in Firefox, you'll see that we have a very nice stack of links. Instead, it's a definite step up from what we had with just the nav class on that ul.

We have a bit more margin, a bit more padding, we have some nice borders going on between these, we have a great hover state, we still have our active state right here, it looks like it's grayed out, it looks like you can't click on it, even though you can. Remember, that's just a trick that the CSS is playing on you. I've discussed that in the previous two videos, and of course, these links continue to look like they go all the way across the page because there's no Scaffolding in place. Hide scaffolding, then you would see these look a bit narrower. So, what about that pill thing that I mentioned before? Well, if I go back here into Dreamweaver, I'm going to take out nav-stacked, and I'm going to change nav-tabs to nav-pills, and if you Save that and Refresh your Firefox web page, you'll see that the navigation has again gone horizontal and the active page that we were on has this lovely blue pill surrounding it, in this case, a blue box with rounded corners, and of course, there is a very nice hover state here as well.

As I hover over these links, you'll see that they have a lovely grayed box also with rounded corners. You could use custom CSS to change these colors or tweak the way that these are styled. Just like we saw with the tabs, you can make this pilled structure also go vertical, and if we hop back in the Dreamweaver again and add nav-stacked just the same way we did with the tabs and save and look at this in Firefox again, you'll see that now our navigation has gone horizontal. We still have our current page clearly marked here with these big blue rounded cornerbacks, and we still have our hover state in place as well.

This is an introduction to tabs and pills and how we can work with them to give us at least three or four different unique looks for how our navigation could look on a web page just with a handful of styles using the Bootstrap framework.

Find answers to the most frequently asked questions about Up and Running with Bootstrap 2.


Expand all | Collapse all
please wait ...
Q: I am trying to create the image carousels shown in this course, and they are not functioning properly. The custom.css file seems to be missing from the exercise files and I think this is the reason. Can you provide it?
A: custom.css isn't created until the carousel indicators are added. However, these styles have to do with the way the indicators look, and nothinghas to do with the way the carousel functions.
 
Are you sure you're working with Bootstrap 2.x? You download that from here: 
http://getbootstrap.com/2.3.2/. The carousel changed radically between Bootstrap 2.x and Bootstrap 3, and this course might not work with version 3.
 
Share a link to this course

What are exercise files?

Exercise files are the same files the author uses in the course. Save time by downloading the author's files instead of setting up your own files, and learn by following along with the instructor.

Can I take this course without the exercise files?

Yes! If you decide you would like the exercise files later, you can upgrade to a premium account any time.

Become a member Download sample files See plans and pricing

Please wait... please wait ...
Upgrade to get access to exercise files.

Exercise files video

How to use exercise files.

Learn by watching, listening, and doing, Exercise files are the same files the author uses in the course, so you can download them and follow along Premium memberships include access to all exercise files in the library.
Upgrade now


Exercise files

Exercise files video

How to use exercise files.

For additional information on downloading and using exercise files, watch our instructional video or read the instructions in the FAQ.

This course includes free exercise files, so you can practice while you watch the course. To access all the exercise files in our library, become a Premium Member.

join now Upgrade now

Are you sure you want to mark all the videos in this course as unwatched?

This will not affect your course history, your reports, or your certificates of completion for this course.


Mark all as unwatched Cancel

Congratulations

You have completed Up and Running with Bootstrap 2.

Return to your organization's learning portal to continue training, or close this page.


OK
Become a member to add this course to a playlist

Join today and get unlimited access to the entire library of video courses—and create as many playlists as you like.

Get started

Already a member?

Become a member to like this course.

Join today and get unlimited access to the entire library of video courses.

Get started

Already a member?

Exercise files

Learn by watching, listening, and doing! Exercise files are the same files the author uses in the course, so you can download them and follow along. Exercise files are available with all Premium memberships. Learn more

Get started

Already a Premium member?

Exercise files video

How to use exercise files.

Ask a question

Thanks for contacting us.
You’ll hear from our Customer Service team within 24 hours.

Please enter the text shown below:

The classic layout automatically defaults to the latest Flash Player.

To choose a different player, hold the cursor over your name at the top right of any lynda.com page and choose Site preferencesfrom the dropdown menu.

Continue to classic layout Stay on new layout
Exercise files

Access exercise files from a button right under the course name.

Mark videos as unwatched

Remove icons showing you already watched videos if you want to start over.

Control your viewing experience

Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.

Interactive transcripts

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.

Are you sure you want to delete this note?

No

Notes cannot be added for locked videos.

Thanks for signing up.

We’ll send you a confirmation email shortly.


Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

Keep up with news, tips, and latest courses with emails from lynda.com.

Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

   
submit Lightbox submit clicked
Terms and conditions of use

We've updated our terms and conditions (now called terms of service).Go
Review and accept our updated terms of service.