Bootstrap 4 Navs And Pills

Bootstrap 4 Navs And Pills

Bootstrap 4 navs and pills provide a simple and easy way to create horizontal and vertical nav components like tabs and pills.

Steps To Create Bootstrap 4 Horizontal Nav

  • Provide id="id-of-collapse-element" and .collapse to the collapsible element .
  • Add .nav to the <ul> element base class.
  • Add .nav-item to the <li> element base class.
  • Add .nav-link to the <a> element base class.

General Syntax

Try it now

Source Code

Try it now

Source Code : Output

Note: In the above example,.nav is assigned to the <ul> ,.nav-item to the <li> & .nav-link to the <a> element base class.

Bootstrap nav creates horizontal and vertical navigation components easily. It has other different properties and features that make the nav component more elegant.

Horizontal Nav Allignment

  • By default nav is left aligned .
  • To align center ,you have to assign .justify-content-center to the <nav> container.
  • To align right ,you have to use .justify-content-end to the <nav> container.
  • To align vertical ,you have to use .flex-column to the <nav> container.

General Syntax

Try it now

Source Code

Try it now

Source Code : Output

Bootstrap Navs Alignment

Note: In the above example,flexbox utility classes are used to align nav component in the left, center and right direction.Please keep in mind that nav component is aligned by default in the left direction.To align center use .justify-content-center & to align right use .justify-content-end.

Tabs

Steps To Create Tab Menu

  • Add .nav and .nav-tabs to the <ul> element base class.
  • Add .nav-item to the <li> element base class.
  • Add .nav-link to the <a> element base class.

General Syntax

Try it now

Source Code

Try it now

Source Code : Output

Note: In the above example,bootstrap tabs can be created by assigning .nav ,.nav-tabs to the <ul> element base class ,.nav-item to the <li> element base class and .nav-link to the <a> element base class.

Tabs: Active/Disabled

  • To make tab link active use .active to the <a> element base class.
  • To make tab link disabled use .disabled to the <a> element base class

General Syntax

Try it now

Source Code

Try it now

Source Code : Output

To make tab item active,assign .active to the <a> element base class while to make disabled tab item,assign .disabled to the <a> element base class.

Step To Create Pills Menus

  • Add .nav and .nav-pills to the <ul> element base class.
  • Add .nav-item to the <li> element base class.
  • Add .nav-link to the <a> element base class.

General Syntax

Try it now

Source Code

Try it now

Source Code : Output

Note: In the above example ,.nav,.nav-pills,.nav-item & .nav-link are used to make bootstrap pill menu.

Pills: Active/Disable Link Item

  • To make tab link active , use.active to the <a> element base class.
  • To make tab link disabled, use.disabled to the <a> element base class

General Syntax

Try it now

Source Code

Try it now

Source Code : Output

Bootstrap Pills

Note: In the above example , active and disabled link item can be created inside pills menu by assigning .active & .disabled to the element base class.

Step To Create Vertical Pills Menus

  • Add .nav, .nav-pills & .flex-column to the <ul> element base class.
  • Add .nav-item to the <li> element base class.
  • Add .nav-link to the <a> element base class.

Source Code

Try it now

Source Code : Output

Bootstrap Vertical Pills

Note: To create vertical pill menu,assign .flex-column to the pills container(<nav>) base class.

Alignment Of Nav/Pill Menu

Full Width Nav Alignment

To extend navigation nav into whole available width,use .nav-fill to the <ul> having class either .nav .nav-pills or .nav .nav-tabs.Please keep in mind that every nav item will not be same width.

General Syntax

Try it now

Source Code

Try it now

Source Code : Output

Bootstrap Pills/Navs Alignment

Note: Navbar component can be extended within full available width,by assigning .nav-fill to the <ul> container base class.

Assigning Equal Width To The Nav/Pill Menu

To align equal width of nav/pill menu item ,use .nav-justified to the

    having class either .nav .nav-pills or .nav .nav-tabs

General Syntax

Try it now

Source Code

Try it now

Source Code : Output

Bootstrap Pills/Navs Alignment

Note: Equal width inside nav/pill menu item can be created very easily by just using .nav-justified.These class must be assigned to the nav container or pill container base class.

Creating Nav Based Navigation

  • Add .nav & .nav-tabs to the <nav> element base class.
  • Add .nav-item & .nav-link to the <a> element base class.

General Syntax

Try it now

Source Code

Try it now

Source Code : Output

Bootstrap Nav Based Navigation

Note: To create nav based navigation,assign .nav & .nav-tabs to the <nav> element base class & assign .nav-link and .nav-item to the <a> element base class.

Creating Pill Based Navigation

  • Add .nav & .nav-pills to the <nav> element base class.
  • Add .nav-item & .nav-link to the <a> element base class.

Source Code

Try it now

Source Code : Output

Bootstrap Pill Based Navigation

Note: To create pill based navigation,assign .nav & .nav-pills to the <nav> element base class & assign .nav-link and .nav-item to the <a> element base class.

Bootstrap Tabs With Dropdown

Bootstrap Tabs With Dropdown can be made by utilizing tabs/pills and dropdown concept.

General Syntax

Try it now

Source Code

Try it now

Source Code : Output

Bootstrap Tab With Dropdown

Note: Bootstrap tab with dropdown can be created very easily by using tabs and dropdown concept.

Bootstrap Pill With Dropdown

Follow pill and dropdown concept to make bootstrap tab with dropdown menu.

General Syntax

Try it now

Source Code

Try it now

Source Code : Output

Bootstrap Tab With Dropdown

Note: Bootstrap pill with dropdown can be created very easiy by using pill and dropdown concept.

Online Test / Quiz