Fixed Layout

Description

The fixed layout has a fixed navbar, navigation menu and footer only content section is scrollable to user. In this page you can experience it. Fixed layout provide seamless UI on different screens.

CSS Classes

This table contains all classes related to the fixed layout. This is a custom layout classes for fixed 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.
.menu-fixed To set the main navigation fixed on page .menu-fixed class needs to add in navigation wrapper. Refer HTML markup line no 12.
.footer-fixed To set the main footer fixed on page .footer-fixed class needs to add in footer wrapper. Refer HTML markup line no 37.

HTML Markup

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

  • Line no 7: Contain the .fixed-top class for adjusting navbar fixed on top.
  • Line no 12: Contain the .menu-fixed class for adjusting main navigation on left side.
  • Line no 37: Contain the .footer-fixed class for adjusting fixed footer.

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 role="navigation" 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-fixed 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-fixed">
                      ...
                  </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 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' for fixed navbar.
verticalMenuConfig menuType string 'menu-fixed' verticalMenuConfig block has a menuType variable, it contains navigation type specific classes in that you need to add 'menu-fixed' for fixed navigation in vertical layout.
horizontalMenuConfig menuType string 'navbar-fixed' horizontalMenuConfig block has a menuType variable, it contains navigation type specific classes in that you need to add 'menu-fixed'for fixed navigation in horizontal layout.
footerConfig footerType string 'fixed-bottom' footerConfig block has a footerType variable, it contains footer specific classes in that you need to add 'footer-fixed' for fixed footer.
PUG Code

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

  • Line no 22-23: Set navbar fixed class to navbarPosition variable value as 'fixed-top' in navbarConfig block for fixed navbar.
  • Line no 25-26: Set vertical layout navigation fixed class to menuType variable value as 'menu-fixed' in verticalMenuConfig block for fixed navigation in vertical layout.
  • Line no 28-29: Set horizontal layout navigation fixed class to menuType variable value as 'footer-fixed' in horizontalMenuConfig block for fixed navigation in horizontal layout.
  • Line no 31-32: Set footer fixed class to footerType variable value as 'footer-fixed' in footerConfig block for fixed footer.
  • Line no 38-39: content block has content section html file included include ../contents/layout-fixed.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 layout-fixed.pug, however you can use it on template level but it will generate whole template as a fixed layout.

              
                  block pageVars
                    - var pageTitle    = "Fixed Layout"
                    - var pageSubTitle = "Fixed navbar, navigation & Footer"
                    - var description  = "The fixed layout page structure have fixed navbar, navigation and footer."
                    - var activeMenu   = "layout-fixed"
                  extends template
                  append pageConfig
                  append navbarConfig
                    - var navbarPosition = "fixed-top" 
                  append verticalMenuConfig
                    - var menuType = 'menu-fixed'
                  append horizontalMenuConfig
                    - var horizontalMenuType = 'navbar-fixed'
                  append footerConfig
                    - var footerType = "fixed-bottom"  
                  append breadcrumbs
                    +breadcrumbs([{url:"index.html",name:"Home"},{url:"#",name:"Page Layouts"}, {name:"Fixed Layout"}])
                  //- Include page content in page block
                  append content
                    include ../contents/layout-fixed.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