NAV MENUS

bootstrap-logo-in-vector

If you want to create a simple horizontal menu, add the .nav class to an <ul> element, followed by .nav-item for each <li> and add the .nav-link class to their links:

ESEMPIO DI CODICE

Copy to Clipboard

Add the .justify-content-center class to center the nav and the .justify-content-end class to right align the nav.

<!– Centered nav –>
<ul class=”nav justify-content-center>

<!– Right-aligned nav –>
<ul class=”nav justify-content-end>

VERTICAL NAV

Add the .flex-column class to create a vertical nav:

CODE TO CREATE A VERTICAL NAV

Copy to Clipboard

TABS

Turn the navigation menu into navigation tabs with the .nav-tabs class. Add the .active class to the active/current link. The cards can be activated, as we will see in the last example.

CODE EXAMPLE FOR TABS

Copy to Clipboard

PILLS

Transform the navigation menu into pills (navigation pills) with the .nav-pills class. If you want the pills to be switchable, see the last example on this page.

<ul class=”nav nav-pills>
  <li class=”nav-item>
    <a class=”nav-link active” href=”#”>Active</a>
  </li>
  <li class=”nav-item>
    <a class=”nav-link” href=”#”>Link</a>
  </li>
</ul>

PILLS CODE WITH DROPDOWN AND TABS WITH DROPDOWN

Copy to Clipboard

DYNAMIC ACTIVATED CARDS

To make tabs focusable, add the data-bs-toggle = “tab” attribute to each link. Then add a .tab-pane class with a unique ID for each tab and wrap them inside a <div> element with .tab-content class. If you want the tabs to fade in and out when you click them, add the .fade class to the .tab pane:

EXAMPLE CODE FOR PILLS AND TABS

Copy to Clipboard
Copy to Clipboard

BOOTSTRAP 5 PAGINATION

If you have a website with many pages, you may want to add some sort of pagination to each page.

To create a basic pagination, add the .pagination class to a <ul> element. Then add .page-item to each <li> element and a .page-link class to each link within <li>:

image
Copy to Clipboard

ACTIVE STATE

The .active class is used to “highlight” the current page.

active page
Copy to Clipboard

DISABLE THE STATE

The .disabled class is used for non-clickable links:

disabled

SIZE OF PAGINATION

Add the .pagination-lg class for larger blocks or .pagination-sm for smaller blocks:

<ul class=”pagination pagination-lg>

<ul class=”pagination pagination-sm>

LINKS TO PREVIOUS POST

BOOTSTRAP 5

LINK TO THE CODE ON GITHUB

GITHUB