Home » bootstrap » Bootstrap Tabs and Pills

Bootstrap Tabs and Pills

Menus

Menus have become a usual part of any website now. A simple HTML menu is the one made with an unordered list <ul>.

It is styled further, as per the web-page requirements, and displayed to the user.

Bootstrap would help you create a horizontal menus with the help of the .list-inline class.

You can add this class to your <ul> tag and you are ready for a basic menu for your website.

But this post isn’t about those menus. Here, we will discuss what we call Tabs and Pills.

These are better styled menus that Bootstrap offers us.

Creating a Tab

To create a tab you need to use to use the class= “nav nav-tabs” attribute with your ul element.

Check out the example below:

You can also use the .active class to highlight the active menu.

Tabs With Dropdown Menu

You might have sub-menus for your menus. These can be displayed as dropdowns for each menu.

See the sample code below for illustration:

 Pills

To create pills you need to set your <ul> element as <ul class=”nav nav-pills”>.

The current page will be active, which can be done by <li class=”active”>:

Vertical Pills

For vertical alignment of the pills you need to add the .nav-stacked class.

Pills with dropdown menus

You can also make the Pills hold dropdown menus.

Here’s an example for the same:

Centered Tabs and Pills

The .nav-justified class will help making the pills centered or justified

Toggleable / Dynamic Tabs

Adding the data-toggle=”tab” attribute will make the tabs toggleable.

You can also use the .tab-pan and .tab-content classes for better content wrapping

Please follow and like us:
error