Bootstrap 5 Navbar Examples: Create Stunning Navigation Menus

Bootstrap 5 offers a range of new features and enhancements, including an updated Navbar component. In this article, we'll explore some Bootstrap 5 Navbar examples that you can use to create stunning navigation menus for your website.

Table of Contents:

  1. Introduction
  2. Basic Bootstrap 5 Navbar Example
  3. Bootstrap 5 Navbar with Dropdowns
  4. Bootstrap 5 Navbar with Icons
  5. Bootstrap 5 Navbar with Search Bar
  6. Bootstrap 5 Navbar with Logo
  7. Bootstrap 5 Navbar with Sticky Header
  8. Bootstrap 5 Navbar with Mobile Menu
  9. Conclusion

Introduction:

Bootstrap 5 is the latest version of the popular front-end development framework. It offers a range of new features and enhancements, including an updated Navbar component. The Navbar is an essential part of any website's navigation, and Bootstrap 5 makes it easier than ever to create stunning navigation menus.

1. Basic Bootstrap 5 Navbar Example

The basic Bootstrap 5 Navbar is a simple and elegant navigation menu that can be customized to suit your website's style. It features a collapsible mobile menu and supports dropdown menus. You can easily add your own logo and adjust the colors to match your website's theme.

Here is an example of a Basic Bootstrap 5 Navbar Example:

Html Code
<nav class="navbar navbar-expand-lg navbar-light bg-light">
 <div class="container-fluid">
   <a class="navbar-brand" href="#">Brand</a>
   <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
     <span class="navbar-toggler-icon"></span>
   </button>
   <div class="collapse navbar-collapse" id="navbarNav">
     <ul class="navbar-nav">
       <li class="nav-item">
         <a class="nav-link active" aria-current="page" href="#">Home</a>
       </li>
       <li class="nav-item">
         <a class="nav-link" href="#">About</a>
       </li>
       <li class="nav-item">
         <a class="nav-link" href="#">Services</a>
       </li>
       <li class="nav-item">
         <a class="nav-link" href="#">Contact</a>
       </li>
     </ul>
   </div>
 </div>
</nav>

2. Bootstrap 5 Navbar with Dropdowns

Dropdown menus are a great way to organize your website's content and make it easier for users to find what they're looking for. Bootstrap 5 offers several options for creating dropdown menus, including the classic dropdown, megamenu, and navbar dropdown. You can customize the colors, fonts, and layout to create a unique look for your dropdown menu.

Here is an example of a Bootstrap 5 Navbar with Dropdowns:

html code
<nav class="navbar navbar-expand-lg navbar-light bg-light">
 <div class="container-fluid">
   <a class="navbar-brand" href="#">Brand</a>
   <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
     <span class="navbar-toggler-icon"></span>
   </button>
   <div class="collapse navbar-collapse" id="navbarNav">
     <ul class="navbar-nav">
       <li class="nav-item">
         <a class="nav-link active" aria-current="page" href="#">Home</a>
       </li>
       <li class="nav-item">
         <a class="nav-link" href="#">About</a>
       </li>
       <li class="nav-item dropdown">
         <a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">
           Dropdown
         </a>
         <ul class="dropdown-menu" aria-labelledby="navbarDropdown">
           <li><a class="dropdown-item" href="#">Action</a></li>
           <li><a class="dropdown-item" href="#">Another action</a></li>
           <li><hr class="dropdown-divider"></li>
           <li><a class="dropdown-item" href="#">Something else here</a></li>
         </ul>
       </li>
       <li class="nav-item">
         <a class="nav-link" href="#">Services</a>
       </li>
       <li class="nav-item">
         <a class="nav-link" href="#">Contact</a>
       </li>
     </ul>
   </div>
 </div>
</nav>

3. Bootstrap 5 Navbar with Icons

Icons are a popular way to enhance navigation menus and make them more visually appealing. Bootstrap 5 makes it easy to add icons to your Navbar, and there are several icon libraries to choose from, including Font Awesome and Bootstrap Icons. You can also customize the size and color of your icons to match your website's style.

Here is an example of a Bootstrap 5 Navbar with Icons:

html code
<nav class="navbar navbar-expand-lg navbar-light bg-light">
 <div class="container-fluid">
   <a class="navbar-brand" href="#"><i class="bi bi-camera-video-fill"></i> Brand</a>
   <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
     <span class="navbar-toggler-icon"></span></button>

<div class="collapse navbar-collapse" id="navbarNav">
 <ul class="navbar-nav">
   <li class="nav-item">
     <a class="nav-link active" aria-current="page" href="#"><i class="bi bi-house-fill"></i> Home</a>
   </li>
   <li class="nav-item">
     <a class="nav-link" href="#"><i class="bi bi-info-circle-fill"></i> About</a>
   </li>
   <li class="nav-item dropdown">
     <a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">
       <i class="bi bi-megaphone-fill"></i> Dropdown
     </a>
     <ul class="dropdown-menu" aria-labelledby="navbarDropdown">
       <li><a class="dropdown-item" href="#">Action</a></li>
       <li><a class="dropdown-item" href="#">Another action</a></li>
       <li><hr class="dropdown-divider"></li>
       <li><a class="dropdown-item" href="#">Something else here</a></li>
     </ul>
   </li>
   <li class="nav-item">
     <a class="nav-link" href="#"><i class="bi bi-people-fill"></i> Services</a>
   </li>
   <li class="nav-item">
     <a class="nav-link" href="#"><i class="bi bi-envelope-fill"></i> Contact</a>
   </li>
 </ul>
</div>
 </div>
</nav>

Note: For the icons used in example 3, I used the Bootstrap Icons library. You can include it in your project by adding the following link to your HTML file:

htmlcode
<link href="https://cdn.jsdelivr.net/npm/[email protected]/font/bootstrap-icons.css" rel="stylesheet">

4. Bootstrap 5 Navbar with Search Bar

Adding a search bar to your Navbar can make it easier for users to find the content they're looking for. Bootstrap 5 offers a built-in search bar component that you can easily add to your Navbar. You can customize the placeholder text, search button, and search bar size to match your website's style.

Here is an example of a Bootstrap 5 Navbar with Search Bar:
html code
<nav class="navbar navbar-expand-lg navbar-light bg-light">
 <div class="container-fluid">
   <a class="navbar-brand" href="#">Brand</a>
   <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
     <span class="navbar-toggler-icon"></span>
   </button>
   <div class="collapse navbar-collapse" id="navbarNav">
     <form class="d-flex ms-auto">
       <input class="form-control me-2" type="search" placeholder="Search" aria-label="Search">
       <button class="btn btn-outline-success" type="submit">Search</button>
     </form>
     <ul class="navbar-nav">
       <li class="nav-item">
         <a class="nav-link active" aria-current="page" href="#">Home</a>
       </li>
       <li class="nav-item">
         <a class="nav-link" href="#">About</a>
       </li>
       <li class="nav-item">
         <a class="nav-link" href="#">Services</a>
       </li>
       <li class="nav-item">
         <a class="nav-link" href="#">Contact</a>
       </li>
     </ul>
   </div>
 </div>
</nav>


5. Bootstrap 5 Navbar with Logo

Adding your own logo to your Navbar can help strengthen your brand identity and make your website more memorable. Bootstrap 5 makes it easy to add your own logo to your Navbar, and you can customize the size and position of the logo to suit your website's design.

Here is an example of a Bootstrap 5 Navbar with Logo:

html code
<nav class="navbar navbar-expand-lg navbar-light bg-light">
 <div class="container-fluid">
   <a class="navbar-brand" href="#">
     <img src="path/to/your/logo.png" alt="Your Logo" height="30">
   </a>
   <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
     <span class="navbar-toggler-icon"></span>
   </button>
   <div class="collapse navbar-collapse" id="navbarNav">
     <ul class="navbar-nav">
       <li class="nav-item">
         <a class="nav-link active" aria-current="page" href="#">Home</a>
       </li>
       <li class="nav-item">
         <a class="nav-link" href="#">About</a>
       </li>
       <li class="nav-item dropdown">
         <a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">
           Dropdown
         </a>
         <ul class="dropdown-menu" aria-labelledby="navbarDropdown">
           <li><a class="dropdown-item" href="#">Action</a></li>
           <li><a class="dropdown-item" href="#">Another action</a></li>
           <li><hr class="dropdown-divider"></li>
           <li><a class="dropdown-item" href="#">Something else here</a></li>
         </ul>
       </li>
       <li class="nav-item">
         <a class="nav-link" href="#">Services</a>
       </li>
       <li class="nav-item">
         <a class="nav-link" href="#">Contact</a>
       </li>
     </ul>
   </div>
 </div>
</nav>


To add your own logo, replace the src attribute of the img tag with the path to your logo file. You can also adjust the height attribute to resize your logo as needed.

Note: Make sure to use a high-quality image file for your logo to ensure it looks crisp and clear on all devices.


6. Bootstrap 5 Navbar with Sticky Header

A sticky header can help improve navigation on your website by keeping the Navbar visible at all times, even when the user scrolls down the page. Bootstrap 5 offers a built-in sticky header component that you can easily add to your Navbar. You can customize the background color and height of the sticky header to match your website's design.

Here is an example of a Bootstrap 5 Navbar with Sticky Header:

html code
<nav class="navbar navbar-expand-lg navbar-light bg-light sticky-top">
 <div class="container-fluid">
   <a class="navbar-brand" href="#">Brand</a>
   <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
     <span class="navbar-toggler-icon"></span>
   </button>
   <div class="collapse navbar-collapse" id="navbarNav">
     <ul class="navbar-nav">
       <li class="nav-item">
         <a class="nav-link active" aria-current="page" href="#">Home</a>
       </li>
       <li class="nav-item">
         <a class="nav-link" href="#">About</a>
       </li>
       <li class="nav-item dropdown">
         <a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">
           Dropdown
         </a>
         <ul class="dropdown-menu" aria-labelledby="navbarDropdown">
           <li><a class="dropdown-item" href="#">Action</a></li>
           <li><a class="dropdown-item" href="#">Another action</a></li>
           <li><hr class="dropdown-divider"></li>
           <li><a class="dropdown-item" href="#">Something else here</a></li>
         </ul>
       </li>
       <li class="nav-item">
         <a class="nav-link" href="#">Services</a>
       </li>
       <li class="nav-item">
         <a class="nav-link" href="#">Contact</a>
       </li>
     </ul>
   </div>
 </div>
</nav>


To make the Navbar sticky, add the sticky-top class to the nav element. This will ensure that the Navbar remains fixed to the top of the screen as the user scrolls.

Note: The sticky-top class is a Bootstrap 5 utility class that applies the necessary CSS styles to make an element sticky.

 

Bootstrap 5 Navbar with Mobile Menu

With more and more users accessing websites on mobile devices, it's essential to have a mobile-friendly navigation menu. Bootstrap 5 offers a built-in mobile menu that is collapsible and easy to use on small screens. You can customize the colors and layout of the mobile menu to match your website's design.


Here is an example of a Bootstrap 5 Navbar with Mobile Menu:

html code
<nav class="navbar navbar-expand-lg navbar-light bg-light">
 <div class="container-fluid">
   <a class="navbar-brand" href="#">Brand</a>
   <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
     <span class="navbar-toggler-icon"></span>
   </button>
   <div class="collapse navbar-collapse" id="navbarNav">
     <ul class="navbar-nav">
       <li class="nav-item">
         <a class="nav-link active" aria-current="page" href="#">Home</a>
       </li>
       <li class="nav-item">
         <a class="nav-link" href="#">About</a>
       </li>
       <li class="nav-item dropdown">
         <a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">
           Dropdown
         </a>
         <ul class="dropdown-menu" aria-labelledby="navbarDropdown">
           <li><a class="dropdown-item" href="#">Action</a></li>
           <li><a class="dropdown-item" href="#">Another action</a></li>
           <li><hr class="dropdown-divider"></li>
           <li><a class="dropdown-item" href="#">Something else here</a></li>
         </ul>
       </li>
       <li class="nav-item">
         <a class="nav-link" href="#">Services</a>
       </li>
       <li class="nav-item">
         <a class="nav-link" href="#">Contact</a>
       </li>
     </ul>
   </div>
 </div>
</nav>


The mobile menu is automatically added by Bootstrap 5 when you use the navbar-toggler button. When the screen size is reduced to a mobile size, the button will appear and allow users to toggle the menu.

Note: Make sure to test your Navbar on mobile devices to ensure that the mobile menu is working properly and that your Navbar is easily navigable on small screens.

Conclusion
Bootstrap 5 offers a range of options for creating stunning navigation menus for your website. Whether you're looking for a basic Navbar or a more complex dropdown menu, Bootstrap 5 has you covered. With its easy-to-use components and flexible customization options, you can create a unique and memorable navigation menu for your website.

Content Summary:

In this article, we explored some Bootstrap 5 Navbar examples that can help you create stunning navigation menus for your website. We covered the basic Navbar, as well as more advanced options such as dropdown menus, icons, search bars, logos, sticky headers, and mobile menus. Bootstrap 5 makes it easy to customize your Navbar to match your website's style and design, and with its built-in components and options, you can create a unique and memorable navigation menu for your users.

Reference:

  1. Bootstrap 5 documentation: https://getbootstrap.com/docs/5.0/components/navbar/
  2. Font Awesome icons: https://fontawesome.com/
  3. Bootstrap Icons: https://icons.getbootstrap.com/
  4. Bootstrap 5 customization options: https://getbootstrap.com/docs/5.0/customize/ 

Tips:

  • Keep your Navbar simple and easy to use. Avoid adding too many links or dropdown menus, as this can overwhelm your users.
  • Use icons and logos to help strengthen your brand identity and make your Navbar more memorable.
  • Optimize your Navbar for mobile devices, as more and more users are accessing websites on their smartphones and tablets.
  • Customize your Navbar to match your website's style and design, but keep it consistent across all pages of your site.
  • Test your Navbar on different devices and screen sizes to ensure that it is easy to use and looks great on all devices.

FAQ:

Q: How do I add a search bar to my Navbar in Bootstrap 5?
A: Bootstrap 5 offers a built-in search bar component that you can easily add to your Navbar. You can customize the placeholder text, search button, and search bar size to match your website's style. Check out the Bootstrap 5 documentation for more information.

Q: Can I customize the colors and layout of my Navbar in Bootstrap 5?
A: Yes, Bootstrap 5 offers a range of customization options for your Navbar, including colors, fonts, and layout. You can use the built-in customization tools or create your own custom CSS to achieve the look you want.

Q: How do I create a sticky header in Bootstrap 5?
A: Bootstrap 5 offers a built-in sticky header component that you can easily add to your Navbar. You can customize the background color and height of the sticky header to match your website's design. Check out the Bootstrap 5 documentation for more information.