grid system bootstrap code example

Example 1: breakpoint bootstrap

// Extra small devices (portrait phones, less than 576px)
// No media query for `xs` since this is the default in Bootstrap

// Small devices (landscape phones, 576px and up)
@media (min-width: 576px) { ... }

// Medium devices (tablets, 768px and up)
@media (min-width: 768px) { ... }

// Large devices (desktops, 992px and up)
@media (min-width: 992px) { ... }

// Extra large devices (large desktops, 1200px and up)
@media (min-width: 1200px) { ... }

Example 2: no-gutter bootstrap 4

<div class="row no-gutters">
  <div class="col-12 col-sm-6 col-md-8">.col-12 .col-sm-6 .col-md-8</div>
  <div class="col-6 col-md-4">.col-6 .col-md-4</div>
</div>

Example 3: col offset in bootstrap

.col-md-3 .offset-md-3

Example 4: bootstrap grids examples

<div class="container">
  <div class="row">
    <div class="col-md-8">.col-md-8</div>
    <div class="col-md-4">.col-md-4</div>
  </div>
</div>

Example 5: bootstrap grid

<div class="container">
  <div class="row">
    <div class="col-sm">
      One of three columns
    </div>
    <div class="col-sm">
      One of three columns
    </div>
    <div class="col-sm">
      One of three columns
    </div>
  </div>
</div>

Example 6: row class in bootstrap

/*
In Bootstrap, the "row" class is used mainly to hold columns in it.
Bootstrap divides each row into a grid of 12 virtual columns. 
In the following example, the col-md-6 div will have the width of 6/12 of the "row"s div, meaning 50%. 
The col-md-4 will hold 33.3%, and the col-md-2 will hold the remaining 16.66%.
*/

<div class="row">
    <div class="col-md-6"></div>
    <div class="col-md-4"></div>
    <div class="col-md-2"></div>
</div>