Snippets Navbar

Bootstrap 5 Navbar with Hover Fill Animation

A responsive header navbar whose links fill with a soft accent from the bottom on hover or focus, with a clear active state, a call-to-action button and a collapsing mobile menu.

Bootstrap 5 No jQuery Jul 2019 2.2K views

<section class="wdw-stage">
  <div class="container" style="max-width: 1040px">
    <div class="wdw-card overflow-hidden">
      <nav class="navbar navbar-expand-md px-3 px-md-4 py-3 bg-body" aria-label="Main">
        <a class="navbar-brand d-flex align-items-center gap-2 fw-bold text-body-emphasis" href="#">
          <span class="wdw-icon" style="width:2.25rem;height:2.25rem;border-radius:.65rem"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m12 3 9 5-9 5-9-5zM3 13l9 5 9-5"/></svg></span>
          Northwind
        </a>
        <button class="navbar-toggler border-0" type="button" data-bs-toggle="collapse" data-bs-target="#mainMenu" aria-controls="mainMenu" aria-expanded="false" aria-label="Toggle navigation">
          <span class="navbar-toggler-icon"></span>
        </button>
        <div class="collapse navbar-collapse" id="mainMenu">
          <ul class="navbar-nav mx-auto gap-1 py-3 py-md-0" id="menu-links"><li class="nav-item"><a class="nav-link menu-fill active" aria-current="page" href="#">Home</a></li><li class="nav-item"><a class="nav-link menu-fill" href="#">About</a></li><li class="nav-item"><a class="nav-link menu-fill is-hover" href="#">Clients</a></li><li class="nav-item"><a class="nav-link menu-fill" href="#">Search us</a></li><li class="nav-item"><a class="nav-link menu-fill" href="#">Contact us</a></li></ul>
          <a class="btn btn-primary rounded-pill px-4" href="#">Get started</a>
        </div>
      </nav>
      <div class="wdw-aurora px-4 px-md-5 py-4 py-md-5">
        <div class="row align-items-center g-4 py-md-3">
          <div class="col-md-6">
            <span class="badge rounded-pill bg-white bg-opacity-10 text-white border border-white border-opacity-25 mb-3 px-3 py-2">Hover the menu</span>
            <h1 class="h2 fw-bold mb-3" style="letter-spacing:-.02em">Menus that respond to the pointer</h1>
            <p class="mb-0 opacity-75">Each item fills from the bottom on hover, so the target feels solid and clear.</p>
          </div>
          <div class="col-md-6 d-none d-md-block">
            <div class="rounded-4 p-4 bg-white bg-opacity-10 border border-white border-opacity-25">
              <div class="d-flex justify-content-between align-items-center mb-3">
                <span class="fw-semibold">Active clients</span><span class="small opacity-75">This month</span>
              </div>
              <div class="display-6 fw-bold mb-3">128</div>
              <div class="progress bg-white bg-opacity-25 mb-2" style="height:.5rem" role="progressbar" aria-label="Onboarding" aria-valuenow="72" aria-valuemin="0" aria-valuemax="100"><div class="progress-bar bg-white" style="width:72%"></div></div>
              <div class="small opacity-75">72% onboarded</div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</section>

Built on Bootstrap 5.3.8 with plain JavaScript — no jQuery. Supports light and dark mode via data-bs-theme.

Free to use in personal and commercial projects under the MIT license.