What is the Grid System?
The grid system is the most important part of Bootstrap. It helps you arrange content in rows and columns, like a table, but much more flexible and responsive.
The Three Building Blocks
| Part | Class | Job |
|---|---|---|
| Container | .container | Wraps and centers the whole layout |
| Row | .row | A horizontal group of columns |
| Column | .col | Holds your content, takes a share of 12 parts |
Your First Grid
Three equal-width columns side by side. Each column takes one-third of the row.
Setting Column Sizes
Write col- followed by a number from 1 to 12 to say how many parts the column should take.
| Class | Width |
|---|---|
col-12 | 100% (full row) |
col-6 | 50% (half) |
col-4 | 33.33% (one third) |
col-3 | 25% (one quarter) |
col-2 | 16.66% |
col-1 | 8.33% |
The Rule of 12
The numbers in one row should add up to 12. If you use more than 12, the extra column moves to the next line (this is called wrapping).
Seeing the Grid Clearly
While learning, add a border and background to the columns so that you can see them:
Why Do We Need a Row?
Columns must always be placed directly inside a .row. The row removes the extra padding of the container using negative margins, which keeps your columns perfectly aligned. Without a row the layout will look uneven.
Common Mistakes
- Putting columns directly inside a container without a row
- Using a wrong total, like
col-5+col-5+col-5, and getting an unexpected line break - Placing text directly inside
.rowinstead of inside a column - Forgetting that the grid has 12 columns, not 10 or 16
col-3, col-6 and col-3. Then make it col-2, col-8, col-2 to see how the middle column grows.
Conclusion
The grid is a simple idea: container, row, columns and a total of 12 parts. Once you are comfortable with it, you can build almost any page layout.

