We have gathered a few Bootstrap 4 grid layout examples below.
Three Equal Columns
When you apply the .col class to a given number of elements, Bootstrap counts the number of elements and generates equal-width columns accordingly. Three col components are used in the sample below, and each one has a width of 33.33%.
Example
col
col
col
Three Equal Columns Using Numbers
Numbers can also be used to regulate the width of the columns. You just need to ensure that the total equals 12 or less (you don’t have to use all 12 columns):
Example
col-4
col-4
col-4
Three Unequal columns
You must utilize integers to make columns that are not equal. This example will split the money into 25%, 50%, and 25%.
Example
col-3
col-6
col-3
Setting One Column Width
Still, it’s sufficient to just specify the width of one column, and the other columns will adjust to fit around it automatically. This example will split the money into 25%, 50%, and 25%.
Example
col
col-6
col
More Equal Columns
Example
1 of 2
2 of 2
1 of 4
2 of 4
3 of 4
4 of 4
1 of 6
2 of 6
3 of 6
4 of 6
5 of 6
6 of 6
Row Cols
Using the .row-cols-* classes, you can also specify how many columns (independent of the number of cols) should be adjacent to one another:
Example
1 of 2
2 of 2
1 of 4
2 of 4
3 of 4
4 of 4
1 of 6
2 of 6
3 of 6
4 of 6
5 of 6
6 of 6
More Unequal Columns
Example
1 of 2
2 of 2
1 of 4
2 of 4
3 of 4
4 of 4
1 of 4
2 of 4
3 of 4
4 of 4
Equal Height
Example
Lorem ipsum...
col
col
Nested Columns
A two-column layout with an additional two columns inside one of the columns can be made using the example below:
Example
.col-8
.col-6
.col-6
.col-4
Responsive Classes
The five classes of the Bootstrap 4 grid system are:
.col- (extra small devices – screen width less than 576px)
.col-sm- (small devices – screen width equal to or greater than 576px)
.col-md- (medium devices– screen width equal to or greater than 768px)
.col-lg- (large devices – screen width equal to or greater than 992px)
.col-xl- (xlarge devices – screen width equal to or greater than 1200px)
More dynamic and adaptable layouts can be made by combining the aforementioned classes.
Tip: Since all classes scale up, you only need to provide smif you want to define the same widths for smand md.
Stacked to Horizontal
The example below demonstrates how to design a column layout that appears stacked on extremely small devices and then becomes horizontal on devices that are larger (sm, md, lg, and xl):
Example
col-sm-9
col-sm-3
col-sm
col-sm
col-sm
Mix and Match
Example
col-6 col-sm-9
col-6 col-sm-3
col-7 col-lg-8
col-5 col-lg-4
col-sm-3 col-md-6 col-lg-4
col-sm-9 col-md-6 col-lg-8
No Gutters
Add the .no-guttersclass to the .row container to remove gutters (extra space):