Fixed Top

Description

The navbar fixed top option has a fixed navbar at the top side. This option can be use with any type of navbar, color & options.

CSS Classes

This table contains all classes related to the fixed navbar layout. This is a custom layout classes for fixed navbar layout page requirements.

All these options can be set via following classes:

Classes Description
.fixed-top To set navbar fixed you need to add .fixed-top class in navbar <nav> tag. Refer HTML markup line no 7.

HTML Markup

This section contains HTML Markup to create fixed navbar layout. This markup define where to add css classes to make navbar fixed.

  • Line no 7: Contain the .fixed-top class for adjusting navbar fixed on top.

Modern has a ready to use starter kit, you can use this layout directly by using the starter kit pages from the modern-admin/starter-kit folder.

        
            <!DOCTYPE html>
              <html lang="en">
                <head></head>
                <body data-menu="vertical-menu" class="vertical-layout vertical-menu 2-column menu-expanded">
                  <!-- fixed-top-->
                  <nav  class="header-navbar navbar-expand-sm navbar navbar-with-menu fixed-top navbar-dark navbar-shadow navbar-border">
                      ...
                  </nav>
                  <!-- BEGIN Navigation-->
                  <div class="main-menu menu-dark menu-shadow">
                      ...
                  </div>
                  <!-- END Navigation-->
                  <!-- BEGIN Content-->
                  <div class="content app-content">
                      <div class="content-wrapper">
                          <!-- content header-->
                          <div class="content-header row">
                              ...
                          </div>
                          <!-- content header-->
                          <!-- content right-->
                          <div class="content-right">
                              ...
                          </div>
                          <!-- content right-->
                      </div>
                  </div>
                  <!-- END Content-->
                  <!-- START FOOTER DARK-->
                  <footer class="footer footer-dark">
                      ...
                  </footer>
                  <!-- START FOOTER DARK-->
                </body>
              </html>
        
        

PUG Configuration

Modern Admin use PUG as template engine to generate pages and whole template quickly using node js, for getting start with PUG usage & template generating process please refer template documentation.

PUG Variables

This table contains required PUG variables to generate fixed navbar layout.

Block Variable Datatype Value Description
navbarConfig navbarPosition string 'fixed-top' navbarConfig block has a navbarPosition variable, it contains navbar specific classes in that you need to add 'fixed-top'.
PUG Code

To generate fixed navbar layout page or template, you need to use following PUG code.

  • Line no 20-21: Set navbar fixed class to navbarConfig variable value as 'fixed-top' in navbarConfig block.
  • Line no 32-33: content block has content section html file included include ../contents/fixed-top.html, which can be customizable on page level.

If you want to use this layout on page level you need to define it on page it self. This template has one example pug file for fixed fixed-top.pug, however you can use it on template level but it will generate whole template as a fixed navbar layout.

              
                  block pageVars
                    - var pageTitle    = "Fixed Top"
                    - var pageSubTitle = "Fixed top navbar"
                    - var description  = "The Fixed top navbar options used to make your navbar set to be fixed at top."
                    - var activeMenu   = "fixed-top"
                  extends template
                  append navbarConfig
                    - var navbarPosition = "fixed-top"
                  append breadcrumbs
                    +breadcrumbs([{url:"index.html",name:"Home"},{url:"#",name:"Navbars"}, {name:"Fixed Top"}])
                  //- Include page content in page block
                  append content
                    include ../contents/fixed-top.html
                  //- Vendor CSS
                  //------------------------------
                  //- Add Vendor specific CSS
                  append vendorcss
                  //- Page CSS
                  //------------------------------
                  //- Add custom page specific CSS
                  append pagecss
                  //- Vendor JS
                  //------------------------------
                  //- Add vendor specific JS
                  append vendorjs  
                  //- Page JS
                  //------------------------------
                  //- Add custom page specific JS
                  append pagejs