Header

Documentation and examples for Front's powerful, responsive navigation header, the navbar. Includes support for branding, navigation, and more, including support for our collapse plugin.

How it works

Here's what you need to know before getting started with the navbar:

  • Navbars require a wrapping .navbar with .navbar-expand{-sm|-md|-lg|-xl} for responsive collapsing and color scheme classes.
  • Headers require a wrapping .u-header with behavior behaviors and their classes for responsiveness.
  • Navbars and their contents are fluid by default. Use optional containers to limit their horizontal width.
  • Use our spacing and flex utility classes for controlling spacing and alignment within navbars.
  • Navbars are responsive by default, but you can easily modify them to change that. Responsive behavior depends on our Collapse JavaScript plugin.
  • Navbars are hidden by default when printing. Force them to be printed by adding .d-print to the .navbar. See the display utility class.
  • Ensure accessibility by using a <nav> element or, if using a more generic element such as a <div>, add a role="navigation" to every navbar to explicitly identify it as a landmark region for users of assistive technologies.

How to use?

Copy-paste the stylesheet <link> into your <head> to load the CSS.

            
              <link rel="stylesheet" href="assets/vendor/animate.css">
            
          

Copy-paste the following <script>s near the end of your pages under JS Front to enable them.

            
              <script src="assets/js/components/hs.header.js"></script>
            
          

Copy-paste the init function under JS Plugins Init., before the closing </body> tag, to enable it.

            
              <script>
                $(window).on('load', function () {
                  // initialization of header
                  $.HSCore.components.HSHeader.init($('#header'));
                });
              </script>
            
          

Supported content

Navbars come with built-in support for a handful of sub-components. Choose from the following as needed:

  • .navbar-brand and .u-header__navbar-brand for your company, product, or project name.
  • .navbar-nav and .u-header__navbar-nav for a full-height and lightweight navigation (including support for dropdowns).
  • .navbar-toggler and .u-hamburger for use with our collapse plugin and other navigation toggling behaviors.
  • .form-inline for any form controls and actions.
  • .navbar-text for adding vertically centered strings of text.
  • .collapse.navbar-collapse for grouping and hiding navbar contents by a parent breakpoint.

Here's an example of all the sub-components included in a responsive light-themed navbar that automatically collapses at the lg (large) breakpoint.

              
                <header id="headerBasic" class="u-header">
                  <div class="u-header__section">
                    <div class="container">
                      <nav class="navbar navbar-expand-md u-header__navbar">
                        <a class="navbar-brand u-header__navbar-brand u-header__navbar-brand-top-space" href="index.html" aria-label="Front">
                          <img src="../../assets/svg/logos/logo.svg" alt="Logo">
                        </a>

                        <button type="button" class="navbar-toggler btn u-hamburger"
                                aria-label="Toggle navigation"
                                aria-expanded="false"
                                aria-controls="navBarBasic"
                                data-toggle="collapse"
                                data-target="#navBarBasic">
                          <span id="hamburgerTrigger" class="u-hamburger__box">
                              <span class="u-hamburger__inner"></span>
                            </span>
                        </button>

                        <div id="navBarBasic" class="collapse navbar-collapse py-0">
                          <ul class="navbar-nav u-header__navbar-nav ml-lg-auto">
                            <li class="nav-item">
                              <a class="nav-link u-header__nav-link" href="#">
                                Home
                              </a>
                            </li>

                            <li class="nav-item">
                              <a class="nav-link u-header__nav-link" href="#">
                                Link
                              </a>
                            </li>

                            <li class="nav-item">
                              <a class="nav-link u-header__nav-link" href="#">
                                Another link
                              </a>
                            </li>

                            <li class="nav-item">
                              <a class="nav-link disabled u-header__nav-link" href="#">
                                Disabled
                              </a>
                            </li>

                            <li class="nav-item d-none d-md-inline-block pl-2 pr-0">
                              <a class="btn btn-sm btn-primary u-btn-primary transition-3d-hover" href="#">
                                Button
                              </a>
                            </li>
                          </ul>
                        </div>
                      </nav>
                    </div>
                  </div>
                </header>
              
            

With dropdown

              
                <header id="headerWithDropdown" class="u-header">
                  <div class="u-header__section">
                    <div class="container">
                      <nav class="js-mega-menu navbar navbar-expand-md u-header__navbar">
                        <a class="navbar-brand u-header__navbar-brand u-header__navbar-brand-top-space" href="index.html" aria-label="Front">
                          <img src="../../assets/svg/logos/logo.svg" alt="Logo">
                        </a>

                        <button type="button" class="navbar-toggler btn u-hamburger"
                                aria-label="Toggle navigation"
                                aria-expanded="false"
                                aria-controls="navBarWithDropdown"
                                data-toggle="collapse"
                                data-target="#navBarWithDropdown">
                          <span id="hamburgerTriggerWithDropdown" class="u-hamburger__box">
                              <span class="u-hamburger__inner"></span>
                            </span>
                        </button>

                        <div id="navBarWithDropdown" class="collapse navbar-collapse py-0">
                          <ul class="navbar-nav u-header__navbar-nav ml-lg-auto">
                            <li class="nav-item">
                              <a class="nav-link u-header__nav-link" href="#">
                                Home
                              </a>
                            </li>

                            <li class="nav-item hs-has-mega-menu u-header__nav-item position-relative"
                                data-event="hover"
                                data-animation-in="slideInUp"
                                data-animation-out="fadeOut"
                                data-position="left">
                              <a id="dropdownMegaMenu" class="nav-link u-header__nav-link" href="javascript:;"
                                 aria-haspopup="true"
                                 aria-expanded="false">
                                Dropdown
                                <span class="fa fa-angle-down u-header__nav-link-icon"></span>
                              </a>

                              <div class="hs-mega-menu u-header__sub-menu" aria-labelledby="dropdownMegaMenu">
                                <ul class="list-inline py-3 mb-0" style="min-width: 220px;">
                                  <li class="dropdown-item px-0">
                                    <a class="nav-link u-list__link px-4" href="#">Action</a>
                                  </li>
                                  <li class="dropdown-item px-0">
                                    <a class="nav-link u-list__link px-4" href="#">Another action</a>
                                  </li>
                                  <li class="dropdown-item px-0">
                                    <a class="nav-link u-list__link px-4" href="#">Something else here</a>
                                  </li>
                                </ul>
                              </div>
                            </li>

                            <li class="nav-item">
                              <a class="nav-link u-header__nav-link" href="#">
                                Another link
                              </a>
                            </li>

                            <li class="nav-item">
                              <a class="nav-link disabled u-header__nav-link" href="#">
                                Disabled
                              </a>
                            </li>

                            <li class="nav-item d-none d-md-inline-block pl-2 pr-0">
                              <a class="btn btn-sm btn-primary u-btn-primary transition-3d-hover" href="#">
                                Button
                              </a>
                            </li>
                          </ul>
                        </div>
                      </nav>
                    </div>
                  </div>
                </header>
              
            

With mega menu

              
                <header id="headerWithMegamenu" class="u-header">
                  <div class="u-header__section">
                    <div class="container">
                      <nav class="js-mega-menu navbar navbar-expand-md u-header__navbar">
                        <a class="navbar-brand u-header__navbar-brand u-header__navbar-brand-top-space" href="index.html" aria-label="Front">
                          <img src="../../assets/svg/logos/logo.svg" alt="Logo">
                        </a>

                        <button type="button" class="navbar-toggler btn u-hamburger"
                                aria-label="Toggle navigation"
                                aria-expanded="false"
                                aria-controls="navBarWithMegamenu"
                                data-toggle="collapse"
                                data-target="#navBarWithMegamenu">
                          <span id="hamburgerTriggerWithMegamenu" class="u-hamburger__box">
                              <span class="u-hamburger__inner"></span>
                            </span>
                        </button>

                        <div id="navBarWithMegamenu" class="collapse navbar-collapse py-0">
                          <ul class="navbar-nav u-header__navbar-nav ml-lg-auto">
                            <li class="nav-item hs-has-mega-menu u-header__nav-item"
                                data-event="hover"
                                data-animation-in="slideInUp"
                                data-animation-out="fadeOut"
                                data-position="left">
                              <a id="withBannerMegaMenu" class="nav-link u-header__nav-link pl-0" href="javascript:;"
                                 aria-haspopup="true"
                                 aria-expanded="false">
                                With banner
                                <span class="fa fa-angle-down u-header__nav-link-icon"></span>
                              </a>

                              <div class="hs-mega-menu w-100 u-header__sub-menu u-header__mega-menu-width-v1 u-header__mega-menu-wrapper-v2" aria-labelledby="withBannerMegaMenu">
                                <div class="row p-0 mr-0">
                                  <div class="col-lg-6 pr-0">
                                    <div class="d-none d-lg-block u-header__banner-v1" data-bg-img-src="../../assets/img/750x750/img1.jpg">
                                      <div class="w-100 text-center u-header__banner-v1-content u-content-centered-y p-4">
                                        <div class="mb-4">
                                          <strong class="d-block u-header__banner-v1-title mb-2">Title</strong>
                                          <span class="u-header__banner-v1-text">Some dummy text</span>
                                        </div>
                                        <a class="btn btn-primary u-btn-primary btn-sm transition-3d-hover" href="#">Learn More <span class="fa fa-angle-right ml-2"></span></a>
                                      </div>
                                    </div>
                                  </div>

                                  <div class="col-lg-6 u-header__mega-menu-wrapper-v3">
                                    <div class="row u-header__mega-menu-wrapper-v1">
                                      <div class="col-sm-6">
                                        <strong class="d-block mb-2">Heading</strong>

                                        <ul class="list-unstyled mb-4">
                                          <li><a class="nav-link u-list__link py-2 px-0" href="#">Action</a></li>
                                          <li><a class="nav-link u-list__link py-2 px-0" href="#">Link</a></li>
                                          <li><a class="nav-link u-list__link py-2 px-0" href="#">Some other link</a></li>
                                          <li><a class="nav-link u-list__link py-2 px-0" href="#">I am link too</a></li>
                                          <li><a class="nav-link u-list__link py-2 px-0" href="#">What's up</a></li>
                                        </ul>

                                        <strong class="d-block mb-2">Heading</strong>

                                        <ul class="list-unstyled mb-4">
                                          <li><a class="nav-link u-list__link py-2 px-0" href="#">Action</a></li>
                                          <li><a class="nav-link u-list__link py-2 px-0" href="#">Link</a></li>
                                        </ul>
                                      </div>

                                      <div class="col-sm-6">
                                        <strong class="d-block mb-2">Heading</strong>

                                        <ul class="list-unstyled mb-4">
                                          <li><a class="nav-link u-list__link py-2 px-0" href="#">Some other link</a></li>
                                          <li><a class="nav-link u-list__link py-2 px-0" href="#">I am link too</a></li>
                                          <li><a class="nav-link u-list__link py-2 px-0" href="#">What's up</a></li>
                                        </ul>

                                        <strong class="d-block mb-2">Heading</strong>

                                        <ul class="list-unstyled u-list">
                                          <li><a class="nav-link u-list__link py-2 px-0" href="#">Bootstrap</a></li>
                                          <li><a class="nav-link u-list__link py-2 px-0" href="#">Friendly</a></li>
                                          <li><a class="nav-link u-list__link py-2 px-0" href="#">Features</a></li>
                                        </ul>
                                      </div>
                                    </div>
                                  </div>
                                </div>
                              </div>
                            </li>

                            <li class="nav-item">
                              <a class="nav-link u-header__nav-link" href="#">
                                Link
                              </a>
                            </li>

                            <li class="nav-item">
                              <a class="nav-link u-header__nav-link" href="#">
                                Another link
                              </a>
                            </li>

                            <li class="nav-item hs-has-mega-menu u-header__nav-item"
                                data-event="hover"
                                data-animation-in="slideInUp"
                                data-animation-out="fadeOut"
                                data-position="right">
                              <a id="linksOnlyMegaMenu" class="nav-link u-header__nav-link" href="javascript:;"
                                 aria-haspopup="true"
                                 aria-expanded="false">
                                LInks only
                                <span class="fa fa-angle-down u-header__nav-link-icon"></span>
                              </a>

                              <div class="hs-mega-menu w-100 u-header__sub-menu u-header__mega-menu-wrapper-v1" aria-labelledby="linksOnlyMegaMenu">
                                <div class="row">
                                  <div class="col-sm-6 col-lg-3 mb-3 mb-lg-0">
                                    <strong class="d-block mb-2">Heading</strong>

                                    <ul class="list-unstyled u-list">
                                      <li><a class="nav-link u-list__link py-2 px-0" href="#">Action</a></li>
                                      <li><a class="nav-link u-list__link py-2 px-0" href="#">Link</a></li>
                                      <li><a class="nav-link u-list__link py-2 px-0" href="#">Some other link</a></li>
                                      <li><a class="nav-link u-list__link py-2 px-0" href="#">I am link too</a></li>
                                    </ul>
                                  </div>

                                  <div class="col-sm-6 col-lg-3 mb-3 mb-lg-0">
                                    <strong class="d-block mb-2">Heading</strong>

                                    <ul class="list-unstyled u-list">
                                      <li><a class="nav-link u-list__link py-2 px-0" href="#">Action</a></li>
                                      <li><a class="nav-link u-list__link py-2 px-0" href="#">Link</a></li>
                                    </ul>
                                  </div>

                                  <div class="col-sm-6 col-lg-3 mb-3 mb-sm-0">
                                    <strong class="d-block mb-2">Heading</strong>

                                    <ul class="list-unstyled u-list">
                                      <li><a class="nav-link u-list__link py-2 px-0" href="#">Some other link</a></li>
                                      <li><a class="nav-link u-list__link py-2 px-0" href="#">I am link too</a></li>
                                      <li><a class="nav-link u-list__link py-2 px-0" href="#">What's up</a></li>
                                    </ul>
                                  </div>

                                  <div class="col-sm-6 col-lg-3">
                                    <strong class="d-block mb-2">Heading</strong>

                                    <ul class="list-unstyled u-list">
                                      <li><a class="nav-link u-list__link py-2 px-0" href="#">Bootstrap</a></li>
                                      <li><a class="nav-link u-list__link py-2 px-0" href="#">Friendly</a></li>
                                      <li><a class="nav-link u-list__link py-2 px-0" href="#">Features</a></li>
                                    </ul>
                                  </div>
                                </div>
                              </div>
                            </li>
                          </ul>
                        </div>
                      </nav>
                    </div>
                  </div>
                </header>
              
            

Logo on top

Wrap the brand and togglers with .u-header--center-aligned__inner .u-header--center-aligned-md__inner classes and using display classes, disable the toggler for the resolution(s) the navbar is not collapsed.

              
                <header id="headerLogoOnTop" class="u-header">
                  <div class="u-header__section">
                    <div class="container">
                      <div class="u-header--center-aligned__inner u-header--center-aligned-md__inner">
                        <a class="navbar-brand u-header__navbar-brand" href="index.html" aria-label="Front">
                          <img src="../../assets/svg/logos/logo.svg" alt="Logo">
                        </a>

                        <button type="button" class="navbar-toggler btn d-md-none u-hamburger"
                                aria-label="Toggle navigation"
                                aria-expanded="false"
                                aria-controls="navBarLogoOnTop"
                                data-toggle="collapse"
                                data-target="#navBarLogoOnTop">
                          <span id="hamburgerTriggerLogoOnTop" class="u-hamburger__box">
                              <span class="u-hamburger__inner"></span>
                            </span>
                        </button>
                      </div>

                      <nav class="js-mega-menu navbar navbar-expand-md u-header__navbar">
                        <!-- Navbar content -->
                      </nav>
                    </div>
                  </div>
                </header>
              
            

Brand

The .navbar-brand can be applied to most elements, but an anchor works best as some elements might require utility classes or custom styles.

.u-header__navbar-brand-top-space removes the padding-top CSS parameter of .u-header__navbar-brand when nav links are less and at the level of the Logo (navbar-brand).

              
                <header id="headerBrand" class="u-header">
                  <div class="u-header__section">
                    <div class="container">
                      <nav class="navbar navbar-expand-md u-header__navbar">
                        <a class="navbar-brand u-header__navbar-brand u-header__navbar-brand-top-space" href="index.html" aria-label="Front">
                          <img src="../../assets/svg/logos/logo.svg" alt="Logo">
                        </a>
                      </nav>
                    </div>
                  </div>
                </header>
              
            

Adding images to the .navbar-brand will likely always require custom styles or utilities to properly size. Here are some examples to demonstrate.

            
              <header id="headerBrandSmallSize" class="u-header">
                <div class="u-header__section">
                  <div class="container">
                    <nav class="navbar navbar-expand-md u-header__navbar">
                      <a class="navbar-brand u-header__navbar-brand u-header__navbar-brand-top-space" href="index.html" style="width: 50px;" aria-label="Front">
                        <img src="../../assets/svg/logos/logo.svg" alt="Logo">
                      </a>
                    </nav>
                  </div>
                </div>
              </header>
            
          

Topbar

Links are moved to dropdown on mobile devices (-sm breakpoint).

              
                <header id="headerheaderTopbar" class="u-header">
                  <div class="u-header__section">
                    <div class="container u-header__hide-content py-3">
                      <div class="d-flex align-items-center mb-0">
                        <div class="position-relative">
                          <a id="languageDropdownInvoker" class="d-flex align-items-center u-unfold-wrapper" href="javascript:;" role="button"
                             aria-controls="languageDropdown"
                             aria-haspopup="true"
                             aria-expanded="false"
                             data-unfold-event="hover"
                             data-unfold-target="#languageDropdown"
                             data-unfold-type="css-animation"
                             data-unfold-duration="300"
                             data-unfold-delay="300"
                             data-unfold-hide-on-scroll="true"
                             data-unfold-animation-in="slideInUp"
                             data-unfold-animation-out="fadeOut">
                             <img class="u-unfold__icon" src="../../assets/vendor/flag-icon-css/flags/4x3/us.svg" alt="SVG">
                            <span class="d-inline-block d-sm-none">US</span>
                            <span class="d-none d-sm-inline-block">United States</span>
                            <span class="fa fa-angle-down u-unfold__icon-pointer"></span>
                          </a>

                          <div id="languageDropdown" class="u-unfold mt-2" aria-labelledby="languageDropdownInvoker">
                            <a class="active u-list__link" href="#">English</a>
                            <a class="u-list__link" href="#">Deutsch</a>
                            <a class="u-list__link" href="#">Español‎</a>
                          </div>
                        </div>

                        <div class="ml-auto">
                          <div class="d-inline-block d-sm-none position-relative mr-2">
                            <a id="jumpToDropdownInvoker" class="d-flex align-items-center u-unfold-wrapper" href="javascript:;" role="button"
                               aria-controls="jumpToDropdown"
                               aria-haspopup="true"
                               aria-expanded="false"
                               data-unfold-event="hover"
                               data-unfold-target="#jumpToDropdown"
                               data-unfold-type="css-animation"
                               data-unfold-duration="300"
                               data-unfold-delay="300"
                               data-unfold-hide-on-scroll="true"
                               data-unfold-animation-in="slideInUp"
                               data-unfold-animation-out="fadeOut">
                              Jump to
                              <span class="fa fa-angle-down u-unfold__icon-pointer"></span>
                            </a>

                            <div id="jumpToDropdown" class="u-unfold mt-2" aria-labelledby="jumpToDropdownInvoker">
                              <a class="u-list__link" href="#">Help</a>
                              <a class="u-list__link" href="#">Contacts</a>
                            </div>
                          </div>

                          <div class="d-none d-sm-inline-block ml-sm-auto">
                            <ul class="list-inline mb-0">
                              <li class="list-inline-item mr-0">
                                <a class="u-header__topbar-nav-link" href="#">Help</a>
                              </li>
                              <li class="list-inline-item mr-0">
                                <a class="u-header__topbar-nav-link" href="#">Contacts</a>
                              </li>
                            </ul>
                          </div>
                        </div>

                        <ul class="list-inline ml-2 mb-0">
                          <li class="list-inline-item">
                            <a class="btn btn-xs u-btn--icon u-btn-text-secondary" href="javascript:;" role="button">
                              <span class="fa fa-search u-btn--icon__inner"></span>
                            </a>
                          </li>

                          <li class="list-inline-item position-relative">
                            <a id="shoppingCartDropdownInvoker" class="btn btn-xs u-btn--icon u-btn-text-secondary" href="javascript:;" role="button">
                              <span class="fa fa-shopping-cart u-btn--icon__inner"></span>
                            </a>
                          </li>

                          <li class="list-inline-item">
                            <a id="sidebarNavToggler" class="btn btn-xs u-btn--icon u-btn-text-secondary u-sidebar__toggler" href="javascript:;" role="button">
                              <span class="fa fa-user-circle u-btn--icon__inner font-size-14"></span>
                            </a>
                          </li>
                        </ul>
                      </div>
                    </div>
                  </div>
                </header>
              
            

One page nav

With our Scroll nav plguin, it is now easy to convert links into scrollable nav.

Wrap the links in a parent element with an ID or class and add the same ID or the class in the JS init function of the hs.scroll-nav.js plugin, add #section-name to the href element you want to be scrolled to a certain content.

            
              <ul id="OnePageScrollNav" class="navbar-nav align-items-md-center u-header__navbar-nav ml-lg-auto">
                <li class="nav-item">
                  <a class="nav-link u-header__nav-link pl-0" href="#home-section">Home</a>
                </li>

                <li class="nav-item">
                  <a class="nav-link u-header__nav-link" href="#pages-section">Pages</a>
                </li>

                <li class="nav-item">
                  <a class="nav-link u-header__nav-link" href="#works-section">Works</a>
                </li>

                <li class="nav-item">
                  <a class="nav-link u-header__nav-link" href="#blog-section">Blog</a>
                </li>

                <li class="nav-item">
                  <a class="nav-link u-header__nav-link" href="#">Link</a>
                </li>

                <li class="nav-item d-none d-md-inline-block pl-2 pr-0">
                  <a class="btn btn-primary u-btn-primary btn-sm transition-3d-hover" href="https://themes.getbootstrap.com/product/front-multipurpose-responsive-template/">Buy Now</a>
                </li>
              </ul>
            
          

You can also use dropdowns.

              
                <ul id="OnePageScrollNavWithDropdown" class="navbar-nav align-items-md-center u-header__navbar-nav ml-lg-auto">
                  <li class="nav-item">
                    <a class="nav-link u-header__nav-link pl-0" href="#home-section">Home</a>
                  </li>

                  <li class="nav-item hs-has-mega-menu u-header__nav-item position-relative"
                      data-event="hover"
                      data-animation-in="slideInUp"
                      data-animation-out="fadeOut"
                      data-position="left">
                    <a id="OnepageDropdownSubmenu" class="nav-link u-header__nav-link" href="javascript:;"
                       aria-haspopup="true"
                       aria-expanded="false">
                      Dropdown
                      <span class="fa fa-angle-down u-header__nav-link-icon"></span>
                    </a>

                    <div class="hs-mega-menu u-header__sub-menu" aria-labelledby="OnepageDropdownSubmenu">
                      <ul class="list-inline py-3 mb-0" style="min-width: 220px;">
                        <li class="dropdown-item px-0">
                          <a class="nav-link u-list__link px-4" href="#action-section">Action</a>
                        </li>
                        <li class="dropdown-item px-0">
                          <a class="nav-link u-list__link px-4" href="#another-action-section">Another action</a>
                        </li>
                        <li class="dropdown-item px-0">
                          <a class="nav-link u-list__link px-4" href="#something-else-section">Something else here</a>
                        </li>
                      </ul>
                    </div>
                  </li>

                  <li class="nav-item">
                    <a class="nav-link u-header__nav-link" href="#works-section">Works</a>
                  </li>

                  <li class="nav-item">
                    <a class="nav-link u-header__nav-link" href="#blog-section">Blog</a>
                  </li>

                  <li class="nav-item">
                    <a class="nav-link u-header__nav-link" href="#">Link</a>
                  </li>

                  <li class="nav-item d-none d-md-inline-block pl-2 pr-0">
                    <a class="btn btn-primary u-btn-primary btn-sm transition-3d-hover" href="https://themes.getbootstrap.com/product/front-multipurpose-responsive-template/">Buy Now</a>
                  </li>
                </ul>
              
            

Color schemes

Theming the navbar has never been easier thanks to the combination of theming classes and background-color utilities. Apply the parent .u-header--navbar-bg class next to .u-header class, choose from .bg-primary for use with primary background colors, or .bg-dark for dark background colors. Then, customize with .bg-* utilities.

            
              <header id="headerPrimary" class="u-header u-header--navbar-bg">
                <div class="u-header__section bg-primary">
                  <!-- Navbar content -->
                </div>
              </header>

              <header id="headerDark" class="u-header u-header--navbar-bg">
                <div class="u-header__section bg-dark">
                  <!-- Navbar content -->
                </div>
              </header>
            
          

Also, White-to-dark and Dar-to-white on scroll options are available.

Transparent

Add a .u-header--bg-transparent class to a parent element (must come before .u-header__section class), also you can use .u-header--white-nav-links{-sm|-md|-lg|-xl} white color nav links class for clear displaying the links.

Transparent .u-header--bg-transparent{-sm|-md|-lg|-xl} classes are also available for responsive breakpoints.

            
              <header id="headerTransparent" class="u-header u-header--bg-transparent u-header--white-nav-links-md">
                <div class="u-header__section">
                  <!-- Navbar content -->
                </div>
              </header>
            
          

And here's an example with border.

            
              <header id="headerTransparentWithBorder" class="u-header u-header--bg-transparent u-header--white-nav-links-md">
                <div class="u-header__section u-header__section-divider">
                  <!-- Navbar content -->
                </div>
              </header>
            
          

Placement

Use our placement-classes to place navbars in non-static positions. Choose from fixed to the top, fixed to the bottom, or stickied to the top (scrolls with the page until it reaches the top, then stays there). Fixed navbars use position: fixed, meaning they're pulled from the normal flow of the DOM and may require custom CSS (e.g., padding-top on the <body>) to prevent overlap with other elements.

Example page: Header default

              
                <header id="headerPlacementDefault" class="u-header">
                  <a class="navbar-brand" href="#">Default</a>
                </header>
              
            
              
                <header id="headerPlacementStatic" class="u-header u-header--static">
                  <a class="navbar-brand" href="#">Static</a>
                </header>
              
            

Example page: Absolute top

              
                <header id="headerPlacementAbsTop" class="u-header u-header--abs-top">
                  <a class="navbar-brand" href="#">Absolute top</a>
                </header>
              
            

Example page: Absolute bottom

              
                <header id="headerPlacementAbsBottom" class="u-header u-header--abs-bottom">
                  <a class="navbar-brand" href="#">Absolute bottom</a>
                </header>
              
            

Example page: Absolute top second screen

              
                <header id="headerPlacementAbsTop2ndScreen" class="u-header u-header--abs-top-2nd-screen">
                  <a class="navbar-brand" href="#">Absolute top second screen</a>
                </header>
              
            

Example page: Stick top

              
                <header id="headerPlacementStickyTop" class="u-header u-header--sticky-top">
                  <a class="navbar-brand" href="#">Sticky top</a>
                </header>
              
            

Example page: Stick bottom

              
                <header id="headerPlacementStickyBottom" class="u-header u-header--sticky-bottom">
                  <a class="navbar-brand" href="#">Sticky bottom</a>
                </header>
              
            

Example page: Floating

              
                <header id="headerPlacementFloating" class="u-header u-header--floating">
                  <a class="navbar-brand" href="#">Floating</a>
                </header>
              
            

Responsive behaviors

Placement classes can utilize .u-header--*{-sm|-md|-lg|-xl}. Learn more placement behaviors.

Navbars can utilize .navbar-toggler, .navbar-collapse, and .navbar-expand{-sm|-md|-lg|-xl} classes to change when their content collapses behind a button. In combination with other utilities, you can easily choose when to show or hide particular elements.

For navbars that never collapse, add the .navbar-expand class on the navbar. For navbars that always collapse, don't add any .navbar-expand class.

JavaScript behavior

Methods

Options can be passed via data attributes or JavaScript. For data attributes, append the option name to data-, as in data-header-fix-moment="".

Attribute Description

data-header-fix-moment

Changes navbar behavior at the time specified by the user.

data-header-fix-effect

Show/hide effect of an element. Available options:
  • slide
  • fade
  • show-hide

data-header-fix-exclude

All the listed classes in this attribute will be removed from the section at the time of commit.

data-header-fix-classes

All the listed classes in this attribute will be added to the section at the time of the commit.

data-effect-compensation

Defines if the data-effect-compensation-* attributes should be enabled.

data-effect-compensation-start-class

Points to the class that will be replaced with specified class in the data-effect-compensation-end-class.

data-effect-compensation-end-class

Points to the class that will be replaced with specified class in data-effect-compensation-start-class, at the value of scroll specified in the data-header-fix-moment.

Placement classes

List of available classes and their descriptions.

Class Description

u-header--static-{media-type}

Static type, behaves as with the rule position: static;. Its geometry is taken into account when rendering a page.

u-header--abs-top-{media-type}

Practically the same as static, but the geometry of this type of header is not taken into account when rendering the page (because of position: absolute;). This type of header is well suited for transparent/half-transparent header designs that are displayed on top of the slider/hero/etc. Its geometry is taken into account when rendering a page.

u-header--abs-top-2nd-screen-{media-type}

This type of header works when we have the first section on the page that has a height: 100vh;, i.e. fullscreen. It is displayed as adhering to the top of the second section in the stream on the page. The geometry of this header is also excluded from the calculation of the positioning of all elements on the page.

u-header--abs-bottom-{media-type}

The same as u-header--abs-top, only the header is displayed as sticking to the bottom of the first section in the stream.

u-header--sticky-top-{media-type}

It is displayed as sticking to the top of the screen always (position: fixed; top: 0;). The geometry of this header is also excluded from the calculation of the positioning of all elements on the page.

u-header--sticky-bottom-{media-type}

It is displayed as always (position: fixed; bottom: 0;) adhered to the top of the screen. The geometry of this header is also excluded from the calculation of the positioning of all elements on the page.

Behaviors

List of available classes and their descriptions.

Class Description

u-header--show-hide-{media-type}

Show/hide an item when scrolling to the user specified time. This moment is given in the form of the number of scrolled pixels, through the attribute data-header-fix-moment="". There are 3 available options for how to show/hide an element using the data-header-fix-effect="" attribute:
  • slide
  • fade
  • show-hide

u-header--change-logo-{media-type}

Changes the logo at the time specified by the user. This moment is given in the form of the number of scrolled pixels, through the attribute data-header-fix-moment="". The markup of the logo is important, and should look like this:
                      
                        <a class="navbar-brand u-header__navbar-brand" href="#" aria-label="Front">
                          <img class="u-header__navbar-brand-default" src="../../assets/svg/logos/logo-white.svg" alt="Logo">
                          <img class="u-header__navbar-brand-on-scroll" src="../../assets/svg/logos/logo.svg" alt="Logo">
                        </a>
                      
                    

u-header--change-appearance-{media-type}

Changes the appearance of the sections at the time specified by the user. This moment is given in the form of the number of scrolled pixels, through the attribute data-header-fix-moment="". You can control the appearance of each section with 2 attributes:
  • data-header-fix-moment-exclude="" - all the listed classes in this attribute will be removed from the section at the time of commit.
  • data-header-fix-moment-classes="" - all the listed classes in this attribute will be added to the section at the time of the commit.
This approach allows you to manage styles without !important CSS parameter.
For example:
                      
                        <div class="u-header__section u-header__section--light bg-secondary"
                             data-header-fix-moment-exclude="u-header__section--light bg-secondary"
                             data-header-fix-moment-classes="u-header__section--primary bg-primary">
                      
                    
In this case, to change the section from gray to dark, we remove u-header__section--light bg-secondary (which by default is on this element) and add u-header__section--primary bg-primary.

u-header--toggle-section-{media-type}

Show/hide one of the header sections (preferably the very first) at the user specified time. This moment is specified as the number of scrolled pixels, through the attribute data-header-fix-moment="". For this, the section itself needs to be given the class .u-header__section--hidden.

u-header--invulnerable-{media-type}

This class is auxiliary and is used to reset the previous behavior (with the previous permission, if the user has changed the window size) on a certain viewport. For example, if the user wants to open/show a section on -xs, -sm, but not higher. (Because Front alike Bootstrap is developed mobile first, a strategy in which we optimize code for mobile devices first and then scale up components as necessary using CSS media queries.), having set -sm it will work and on permissions above, in order to prevent it use this class.
For example:
                      
                        <header class="u-header--toggle-section u-header--invulnerable-md">
                          ...
                        </header>
                      
                    
here the behavior of toggle-section will work until the resolution is -md (that is, xs, sm), on viewport -md it will not work.

A certain behavior is tied to a specific position

Because of the complexity of the task itself with behaviors and positions, a certain behavior is tied to a specific position. That is, if you want the above -lg to work show-hide, you need to specify 2 classes.

For example:

              
                <header class="u-header--show-hide-lg u-header--abs-top-lg">
                  ...
                </header>
              
            

Behavior classes

List of available classes and their descriptions.

These placement classes can have the following behavior classes Description

u-header--static-{media-type}

  • u-header--show-hide-{media-type}
  • u-header--change-logo-{media-type}
  • u-header--change-appearance-{media-type}

u-header--abs-top-{media-type}

  • u-header--show-hide-{media-type}
  • u-header--change-logo-{media-type}
  • u-header--change-appearance-{media-type}

u-header--abs-top-2nd-screen-{media-type}

  • u-header--change-logo-{media-type}
  • u-header--change-appearance-{media-type}

u-header--abs-bottom-{media-type}

  • u-header--change-logo-{media-type}
  • u-header--change-appearance-{media-type}

u-header--sticky-top-{media-type}

  • u-header--show-hide-{media-type}
  • u-header--change-logo-{media-type}
  • u-header--change-appearance-{media-type}
  • u-header--toggle-section-{media-type}

u-header--sticky-bottom-{media-type}

  • u-header--show-hide-{media-type}
  • u-header--change-logo-{media-type}
  • u-header--change-appearance-{media-type}
  • u-header--toggle-section-{media-type}

Behavior examples

.u-header--show-hide

              
                data-header-fix-moment="500"
                data-header-fix-effect="slide"
              
            

.u-header--change-logo

              
                <a class="navbar-brand u-header__navbar-brand" href="#" aria-label="Front">
                  <img class="u-header__navbar-brand-default" src="../../assets/svg/logos/logo-white.svg" alt="Logo">
                  <img class="u-header__navbar-brand-on-scroll" src="../../assets/svg/logos/logo.svg" alt="Logo">
                </a>
              
            

.u-header--change-appearance

              
                <header class="u-header__section u-header__section--light bg-white py-7"
                        data-header-fix-moment-exclude="bg-primary py-9"
                        data-header-fix-moment-classes="bg-dark py-5">
                </header>