Bootstrap snippet and html example. Bootstrap 4 Grid System Guide

This html snippet was created to help web designers, web developers, front-end and back-end developer save time. Use it for free in your project and build your app faster, You can also download the HTML, CSS, and JS code.

HTML code

This is the html code used to create this bootstrap snippet, You can copy and paste the following html code inside a page with bootstrap 4.3.1 included, to get the result that you can see in the preview selection





<!-- GRID SYSTEM - HTML -->

<!-- Grid System: Settings -->
<div class="grid-settings">
  <div class="card">
    <div class="card-header">Grid System Settings</div>
    <div class="card-body">
    <p class="card-text mb-2">Grid options:</p>
    <a href="#" id="show-grid" class="btn btn-block btn-sm btn-danger mb-0" type="submit">Hide Grid</a>
    <a href="#" id="show-gutters" class="btn btn-block btn-sm btn-danger mb-2">Remove Gutter</a>
      <a href="#" id="grid-theme" class="btn btn-block btn-sm btn-dark mb-2">Grid Dark</a>
      <p class="card-text mb-2">Container option:</p>
    <a href="#" id="change-container" class="btn btn-block btn-sm btn-primary mb-2" type="submit">Container Size</a>
    </div>
  </div>
</div>

<!-- Grid System: Grids -->
<div class="container grid-system">
  <div class="row">
      <div class="col-1">
        <div class="col-div">1</div>
      </div>
      <div class="col-1">
        <div class="col-div">2</div>
      </div>
      <div class="col-1">
        <div class="col-div">3</div>
      </div>
      <div class="col-1">
        <div class="col-div">4</div>
      </div>
      <div class="col-1">
        <div class="col-div">5</div>
      </div>
      <div class="col-1">
        <div class="col-div">6</div>
      </div>
      <div class="col-1">
        <div class="col-div">7</div>
      </div>
      <div class="col-1">
        <div class="col-div">8</div>
      </div>
      <div class="col-1">
        <div class="col-div">9</div>
      </div>
      <div class="col-1">
        <div class="col-div">10</div>
      </div>
      <div class="col-1">
        <div class="col-div">11</div>
      </div>
      <div class="col-1">
        <div class="col-div">12</div>
      </div>
  </div>
</div>

<!-- YOUN WON'T NEED ANY OF THESE BELOW: -->

<!-- Navbar -->
<nav class="navbar navbar-light bg-light px-0">
  <div class="container-fluid">
  <a class="navbar-brand" href="#">
    <img src="https://getbootstrap.com/docs/4.3/assets/brand/bootstrap-solid.svg" width="30" height="30" class="d-inline-block align-top mr-3" alt="">Grid4BS
  </a>
    <span class="navbar-text">
      A visible grid system for Bootstrap
    </span>
    </div>
</nav>

<main role="main">

  <!-- Jumbotron -->
  <div class="jumbotron px-0">
    <div class="container">
      <h1 class="display-3">Hello, world!</h1>
      <p>This is a template for a simple marketing or informational website. It includes a large callout called a jumbotron and three supporting pieces of content. Use it as a starting point to create something more unique.</p>
      <p><a class="btn btn-primary btn-lg" href="#" role="button">Learn more &raquo;</a></p>
    </div>
  </div>

  <div class="container">
    <!-- Example row of columns -->
    <div class="row">
      <div class="col-md-4">
        <h2>Heading</h2>
        <p>Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui. </p>
        <p><a class="btn btn-secondary" href="#" role="button">View details &raquo;</a></p>
      </div>
      <div class="col-md-4">
        <h2>Heading</h2>
        <p>Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui. </p>
        <p><a class="btn btn-secondary" href="#" role="button">View details &raquo;</a></p>
      </div>
      <div class="col-md-4">
        <h2>Heading</h2>
        <p>Donec sed odio dui. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Vestibulum id ligula porta felis euismod semper. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa.</p>
        <p><a class="btn btn-secondary" href="#" role="button">View details &raquo;</a></p>
      </div>
    </div>

    <hr>

  </div> <!-- /container -->

</main>

<footer class="container">
  <p>&copy; Company 2017-2019</p>
</footer>

CSS code

This is the css code used to create this bootstrap snippet, You can copy and paste the following css code inside a page with bootstrap 4.3.1 included, to get the result that you can see in the preview selection





/* GRID SYSTEM - CSS */

/* Grid System: Settings */
.grid-settings {
  position: fixed; 
  width: 200px;
  top: 80px;
  right: 20px; 
  z-index: 9999; 
}

/* Grid System: Grids */
.grid-system {
  text-align: center;
  position: fixed;
  right: 0;
  left: 0; 
  margin-right: auto;
  margin-left: auto;
  height: 100vh;
  z-index: 1;
  visibility: visible;
}
.grid-system div[class^="col-"] {
    border-left: 1px dotted rgba(0, 0, 0, 0.2);
    height: 100vh;
}
.grid-system div[class^="col-"]:last-child {
    border-right: 1px dotted rgba(0, 0, 0, 0.2);
}
.grid-system .col-div {
    background-color: rgba(0, 0, 0, 0.025);
    border: none !important; 
    padding-top: 15px; 
    color: rgba(0, 0, 0, 0.3);
}

/* Grid System: Light Theme */
.grid-system.light .col-div { 
  background-color: rgba(255, 255, 255, 0.025); 
  color: rgba(255, 255, 255, 0.3);
}
.grid-system.light div[class^="col-"], 
.grid-system.light div[class^="col-"]:last-child { 
  border-color: rgba(255, 255, 255, 0.2);
}

/* FOR DEMO PURPOSES ONLY: */
.bg-dark h1, .bg-dark h2 {
  color: #fff;
}
.bg-dark p {
  color: rgba(255, 255, 255, .5);
}
.grid-settings .card-body p {
  color: #212529;;
}

Javascript/Jquery code

This is the javascript code used to create this bootstrap snippet, You can copy and paste the following javascript code inside a page with bootstrap 4.3.1 included, to get the result that you can see in the preview selection





/* GRID SYSTEM - JS */

// Show - Hide Grid
$( '#show-grid' ).click(function() {
  $( ".grid-system" ).toggleClass( "invisible" ); 
  $( this ).toggleClass( "btn-danger" ).addClass( "btn-success" ); 
  $(this).text(function(i, text){
          return text === "Show Grid" ? "Hide Grid" : "Show Grid";
      })
});

// Add - Remove Gutters
$( '#show-gutters' ).click(function() { 
  $( this ).toggleClass( "btn-danger" ).addClass( "btn-success" ); 
if ($( ".row" ).hasClass( "no-gutters" ) == true) {
        $( ".row" ).removeClass( "no-gutters" ); 
  $( this ).html( "Remove Gutter" );
}
else if ($( ".row" ).hasClass( "no-gutters" ) == false) {
        $( ".row" ).addClass( "no-gutters" ); 
  $( this ).html( "Add Gutter" );
}
});

// Dark - Light Grid Theme
$( '#grid-theme' ).click(function() {
  $( ".grid-system" ).toggleClass( "light" ); 
      
      // THESE LINES ARE:
      $( ".navbar" ).toggleClass( "bg-dark" ); 
      $( ".navbar" ).toggleClass( "navbar-dark" ); 
      $( ".jumbotron" ).toggleClass( "bg-dark" ); 
      $( "body" ).toggleClass( "bg-dark" ); 
      // FOR DEMO PURPOSES ONLY!
      
  $( this ).toggleClass( "btn-dark" ).addClass( "btn-light" ); 
  $(this).text(function(i, text){
          return text === "Grid Light" ? "Grid Dark" : "Grid Light";
      })
});

// Change Container Size
$( '#change-container' ).click(function() {
if ($( ".container" )[0]){
        $( ".container" ).removeClass( "container" ).addClass( "container-fluid" ); 
}
else if ($( ".container-fluid" )[0]){ 
  $( ".container-fluid" ).removeClass( "container-fluid" ).addClass( "container"); 
}
}); 

Similar snippets

Bootstrap example and template. colored modals

colored modals

Bootstrap example and template. project details

project details

Bootstrap example and template. profile with team section

profile with team section

Bootstrap example and template. bs4 seller cards

bs4 seller cards

Bootstrap example and template. bs5 dark footer

bs5 dark footer

Bootstrap example and template. Gradients dashboard cards

Gradients dashboard cards

Bootstrap example and template. profile task with team cards

profile task with team cards

Bootstrap example and template. Services

Services

Bootstrap example and template. Bootstrap 4 Grid System Guide

About this bootstrap example/template

We hope you will enjoy this awesome snippet and stay tuned for the latest updates, bootdey snippets are already used in thousands of blogs, websites and projects. We believe it will save your precious time and gives trendy look to your next web project.

We always try to offer the best beautiful and responsive source of Bootstrap code examples and components.

This code example currectly have 317 views, Using this bootstrap snippet you have the following benefits:

Bootstrap 4.3.1

<link rel='stylesheet' href='https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css'>

<script src='https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js'></script>

This code example is based on bootstrap 4.3.1 and the grid system of this framework

Responsive

Based on bootstrap framework makes all the layouts perfectly responsive for all devices

Crossbrowser compatibility

Tested on all major browsers, it works smoothly on all of them

Jquery plugins

Great built-in plugins with jquery framework, you can easy to change all declarations

semantic html 5

Built on html / css3 the code quality is really amazing

Simple Integration

This code example can be simply integrated on existing sites and new ones too, all you need to do is copy the code and start working