How can I make Bootstrap columns all the same height?
Master System Design with Codemia
Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.
Bootstrap is a powerful, mobile-first front-end framework that is widely used in web development to create responsive and dynamic websites. One of the common questions that arises when using Bootstrap’s grid system is how to make columns all the same height regardless of their content.
Understanding the Bootstrap Grid System
Bootstrap’s grid system is built with flexbox in Bootstrap 4 and later, which facilitates more flexible and advanced layout capabilities compared to earlier Bootstrap versions that used float-based layouts. The system consists of containers, rows, and columns that help structure the content in a flexible and responsive manner.
Using Flexbox to Achieve Equal Height Columns
Flexbox makes it fairly straightforward to set equal height columns within a row. Since Bootstrap’s .row class is already display:flex, columns within a row automatically become flex items.
Here’s a simple example illustrating equal height columns:
Aligning Items Within Columns
Sometimes, aligning content within these equal-height columns is necessary. Bootstrap 4 provides utility classes for aligning content along the cross axis (perpendicular to the main axis). Here are a few classes:
.align-items-start: Aligns items to the start of the container..align-items-end: Aligns items to the end of the container..align-items-center: Aligns items in the center of the container..align-items-stretch: (default) Stretches items to fill the container.
For example:
Stretching Columns Vertically
If you explicitly need to force columns to be the same height (useful when not all columns are direct children of the same .row or when nesting grids):
Handling Different Column Content Sizes
When columns have different amounts of content, the default behavior is to fit the content. Using utility classes like min-vh-100 or custom CSS can force them to take up a minimum height, which can help in creating visually appealing layouts.
Summary Table on Bootstrap Utility Classes for Column Heights
| Utility Class | Purpose |
.align-items-start | Aligns items to the start of the flex container |
.align-items-end | Aligns items to the end of the flex container |
.align-items-center | Centers items in the flex container |
.align-items-stretch | Stretches items to fill the flex container |
h-100 | Makes an element take the full height of its parent |
d-flex | Applies display:flex to an element |
m-auto | Margins auto to center content within a flex container |
Conclusion
Using Bootstrap’s flex-based grid system makes it relatively straightforward to create equal height columns. The provided utility classes can accommodate various content alignment needs within these columns. Understanding and applying these techniques can greatly improve the aesthetic and functional quality of a web layout.

