bootstrap column size code example
Example 1: 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 2: columns center bootstrap 3
<div class="row">
<div class="col-md-2 col-md-offset-5"></div>
</div>
Example 3: bootstrap breakpoints
// 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 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 4 Grid
<!-- Control the column width, and how they should appear on different devices -->
<div class="row">
<div class="col-*-*"></div>
<div class="col-*-*"></div>
</div>
<div class="row">
<div class="col-*-*"></div>
<div class="col-*-*"></div>
<div class="col-*-*"></div>
</div>
<!-- Or let Bootstrap automatically handle the layout -->
<div class="row">
<div class="col"></div>
<div class="col"></div>
<div class="col"></div>
</div>
Example 6: bootstrap grid
<!----------------------- BOOTSTRAP GRID SYSTEM ------------------------>
This code will create 4 boxes placed side by side, which will be
dynamically positioned, according to the size of the screen. We define
the following behavior:
<!-- Desktop Display: we have 4 columns per row (each occupies 3 units out of 12) -->
class = "col-lg-3" <!-- display large with 12/3 = 4 columns -->
<!-- Tablet Display: we have 3 columns per row (each occupies 4 units out of 12) -->
class = "col-md-4" <!-- display medium with 12/4 = 3 columns -->
<!-- Mobile Display: we have 2 columns per row (each occupies the 6 units of 12) -->
class = "col-sm-6" <!-- display small with 12/6 = 2 columns -->
<!-- CODE -->
<div class="row">
<div class="col-lg-3 col-md-4 col-sm-6" style="background-color:red; border:1px solid black;">
One of four columns
</div>
<div class="col-lg-3 col-md-4 col-sm-6" style="background-color:yellow; border:1px solid black;">
One of four columns
</div>
<div class="col-lg-3 col-md-4 col-sm-6" style="background-color:green; border:1px solid black;">
One of four columns
</div>
<div class="col-lg-3 col-md-4 col-sm-6" style="border:1px solid black;">
One of four columns
</div>
</div>