Course Content
Bootstrap 5 Alerts
0/1
Progress Bars
0/1
Spinners
0/1
Pagination
0/1
List Groups
0/1
Bootstrap 5 Scrollspy
0/1
Bootstrap
About Lesson

Introduction to Bootstrap 5 Navbar

  • .navbar → Creates a responsive navbar
  • .navbar-brand → Defines the brand/logo
  • .navbar-nav → Groups navigation links
  • .nav-item → Defines a menu item
  • .nav-link → Defines a clickable link

Example: Basic Navbar

HTML
<nav class="navbar bg-light">
  <div class="container">
    <a class="navbar-brand" href="#">My Website</a>
    <ul class="navbar-nav">
      <li class="nav-item"><a class="nav-link" href="#">Home</a></li>
      <li class="nav-item"><a class="nav-link" href="#">About</a></li>
    </ul>
  </div>
</nav>

Output:

Explanation:

  • .navbar creates a horizontal navigation bar.
  • .navbar-brand is used for the logo or site name.