2 Columns

CSS Classes

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

All these options can be set via following classes:

Classes Description
.2-columns You can create 2 columns layout by adding .2-columns class in <body> tag.

HTML Markup

This section contains HTML Markup to create 2 columns layout. You need to add the .2-columns class in the <body> tag as show in below markup on line no 4. This layout has a navigation and content sections with common header & footer.

Modern has a ready to use starter kit, you can use this layout directly by using the sk-2-columns.html

        
            <!DOCTYPE html>
              <html lang="en">
                <head></head>
                <body data-menu="vertical-menu" class="vertical-layout vertical-menu 2-columns menu-expanded">
                  
                  <!-- fixed-top-->
                  <nav role="navigation" class="header-navbar 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 modern-content container-fluid">
                  </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 2 columns layout.

Variable Value Description
contentLayout '2-columns' You need to set contentLayout variable value as '2-columns' in pageConfig block.
PUG Code

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

Line no 19-20: pageConfig block has a template specific configuration variables, in that for 2 columns layout need to define variable - var contentLayout = '2-columns'

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 2 columns layout-2-columns.pug, however you can use it on template level but it will generate whole template as a 2 columns.

              
                block pageVars
                    - var pageTitle    = "2 Columns"
                    - var pageSubTitle = "2 columns layout with navigation"
                    - var description  = "The full width 2 columns layout with content & navigation section."
                    - var activeMenu   = "layout-2-columns"

                extends template

                append breadcrumbs
                    +breadcrumbs([{url:"index.html",name:"Home"},{url:"#",name:"Page Layouts"}, {name:"2 Columns"}])

                //- Include page content in page block
                append content
                    include ../contents/layout-2-columns.html

                //- Vendor CSS
                append vendorcss
                    link(rel='stylesheet', type='text/css', href='../app-assets/vendors/css/ui/prism.min.css')

                //- Vendor JS
                //------------------------------
                //- Add vendor specific JS
                append vendorjs
                    script(src='../app-assets/vendors/js/ui/prism.min.js', type='text/javascript')
              
              

Please note that Modern Admin Template default layout is 2 columns.If you do not define pageConfig block on page or template level, it will consider 2 columns by default.

Refer following links for detailed documentation, configuration options, methods and examples:
Type URL
2 Columns Layout https://pixinvent.com/modern-admin-clean-bootstrap-4-dashboard-html-template/html/ltr/vertical-menu-template/layout-2-columns.html