Bootstrap Extended Navbar

Unlike the other Bootstrap demo this one showcases how to easily integrate Navbar with its full features and markup with Bootstrap. Only a couple of variables are required with your special flavor and you're ready to go.

Demo Highlights

Bootstrap Extended SCSS

In terms of SCSS, this demo is very much the same with the default layout, we only removed a series of style rules with a couple of specific SCSS variable values, just because we can.

// navbar-bootstrap-extended.scss - mixins
@import "variables", "mixins", "root";

@include navbar-mobile-layout;
@include navbar-desktop-layout;
@include navbar-style;
@include nav-layout;
@include nav-style;
@include subnav-style;
@include main-menu;

As you can see, so far bootstrap-extended.scss is identical with navbar.scss, however for this demo we've setup a set of custom CSS variables:

// bootstrap-extended.html - custom CSS variable values
.navbar {
  --nv-font-size: inherit;
  --nv-bg: var(--bs-gray-dark);
  --nv-subnav-bg: var(--bs-gray-200);
  --nv-padding-x: 0.5rem;
  --nv-padding-y: 0.5rem;
  --nv-subnav-padding-x: .5rem;
  --nv-subnav-padding-y: .5rem;
  --nv-item-padding-y: .5rem;
  --nv-item-padding-x: 1rem;
  --nv-item-padding: var(--nv-item-padding-y) var(--nv-item-padding-x);
  --nv-item-hover-bg: rgba(255,255,255,.15);
  --nv-item-hover-color: rgba(255,255,255,.65);
  --nv-item-active-bg: var(--bs-primary);
  --nv-item-active-color: var(--bs-white);
  --nv-subnav-item-hover-color: rgba(0,0,0,.75);
  --nv-subnav-item-hover-bg: rgba(0,0,0,.125);
  --nv-subnav-item-active-color: var(--bs-white);
  --nv-subnav-item-active-bg: var(--bs-primary);
  --nv-subnav-larger-width: calc(var(--nv-subnav-width) * 3 + var(--nv-subnav-padding-x) * 2);
}
@media (min-width: 768px) {
  .navbar {
    --nv-padding-y: 0;
    --nv-item-padding-y: 1rem;
    --nv-item-padding-x: 1rem;
  }
}

More Demos?

That's it for today, please don't forget to like share and subscribe. Click the notification bell to get notified when we upload new content. We are planning on adding more demos in the future, as time permits.

thednp © 2024 Go back to top