Bs Grids
Bootstrap Grids
Bootstrap Grid System
Bootstrap's grid organisation allows upwardly to 12 columns across the page.If yous job non wishing to purpose all 12 columns individually, yous tin grouping the columns together to job wider columns:
span 1 | span 1 | span 1 | span 1 | span 1 | span 1 | span 1 | span 1 | span 1 | span 1 | span 1 | span 1 |
span 4 | span 4 | span 4 | |||||||||
span 4 | span 8 | ||||||||||
span 6 | span 6 | ||||||||||
span 12 |
Grid Classes
The Bootstrap grid organisation has 4 classes:xs
(for phones - screens less than 768px wide)sm
(for tablets - screens equal to or greater than 768px wide)md
(for pocket-size laptops - screens equal to or greater than 992px wide)lg
(for laptops in addition to desktops - screens equal to or greater than 1200px wide)
Basic Structure of a Bootstrap Grid
The next is a basic construction of a Bootstrap grid: <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>
<div class="row">
...
</div>
<div class="row">
). Then, add together the desired release of columns (tags amongst appropriate .col-*-*
classes). Note that numbers inward .col-*-*
should e'er add together upwardly to 12 for each row.Below nosotros accept collected around examples of basic Bootstrap grid layouts.
Three Equal Columns
.col-sm-4
.col-sm-4
.col-sm-4
Example
<div class="row">
<div class="col-sm-4">.col-sm-4</div>
<div class="col-sm-4">.col-sm-4</div>
<div class="col-sm-4">.col-sm-4</div>
</div>
Two Unequal Columns
.col-sm-4
.col-sm-8
Example
<div class="row">
<div class="col-sm-4">.col-sm-4</div>
<div class="col-sm-8">.col-sm-8</div>
</div>
Tip: You volition acquire to a greater extent than nearly Bootstrap grids after inward this tutorial.
Comments
Post a Comment