Bootstrap 5 Grid
We have gathered a few Bootstrap 5 grid layout examples below.
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%.
col
col
col
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):
col-4
col-4
col-4
You must utilize integers to make columns that are not equal. This example will split the money into 25%, 50%, and 25%.
col-3
col-6
col-3
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%.
col
col-6
col
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
Using the .row-cols-* classes, you can also specify how many columns (independent of the number of cols) should be adjacent to one another:
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
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
Lorem ipsum...
col
col
A two-column layout with an additional two columns inside one of the columns can be made using the example below:
.col-8
.col-6
.col-6
.col-4
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):
col-sm-9
col-sm-3
col-sm
col-sm
col-sm
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
Use any class ending in.g-1|2|3|4|5 to alter the gutters (additional space) between columns (.g-4 is default).
To eliminate the gutter entirely, utilize..g-0:
CodingAsk.com is designed for learning and practice. Examples may be made simpler to aid understanding. Tutorials, references, and examples are regularly checked for mistakes, but we cannot guarantee complete accuracy. By using CodingAsk.com, you agree to our terms of use, cookie, and privacy policy.
Copyright 2010-2024 by Refsnes Data. All Rights Reserved.