Question
I am using Bootstrap and want three columns in the same row to have equal height. In my example, I want the red and blue columns to stretch so they match the height of the yellow column, which contains more content.
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />
<div class="container-fluid">
<div class="row">
<div class="col-xs-4 panel" style="background-color: red;">
some content
</div>
<div class="col-xs-4 panel" style="background-color: yellow;">
catz
<img width="100" height="100" src="https://lorempixel.com/100/100/cats/" alt="Cat image">
</div>
<div class="col-xs-4 panel" style="background-color: blue;">
some more content
</div>
</div>
</div>
How can I make all three Bootstrap columns the same height?
Short Answer
By the end of this page, you will understand why Bootstrap columns do not automatically match heights, and how to make them equal height using reliable CSS techniques such as Flexbox and older fallback approaches. You will also see when each method is appropriate in real projects.
Concept
Bootstrap's grid system is mainly about width, not equal height. A .row groups columns horizontally, and each .col-* gets a percentage width. However, the height of each column is still based on its own content.
That means:
- a column with more text or an image becomes taller
- a column with less content stays shorter
- Bootstrap 3 does not automatically make sibling columns equal height
To make columns the same height, you need a layout method that tells the browser to treat the columns as items that should stretch to match each other.
Why this matters
Equal-height columns are common in:
- card layouts
- pricing tables
- dashboard panels
- feature comparison sections
- product grids
Without equal heights, layouts can look uneven and harder to scan.
The most common solution: Flexbox
The modern CSS solution is Flexbox. When you make the row a flex container, its children can stretch to the same height automatically.
In Bootstrap 3, Flexbox is not built into the grid by default, but you can add it with custom CSS.
Important note about Bootstrap versions
- Bootstrap 3: usually needs custom CSS for equal-height columns
- Bootstrap 4/5: use Flexbox-based grid, so equal-height behavior is easier to achieve
For the code in the question, which uses Bootstrap 3.3.7, the best practical answer is to add custom CSS.
Mental Model
Imagine three books standing on a shelf.
- Each book has the same width category because Bootstrap decides how much horizontal space each one gets.
- But each book has its own height depending on how much content is inside.
By default, Bootstrap only organizes the books side by side. It does not force the shorter books to grow taller.
Flexbox acts like a shelf that says: all books in this row should stretch to the same height as the tallest one.
So the tallest column becomes the reference, and the others stretch to match it.
Syntax and Examples
The modern approach is to make the .row a flex container.
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />
<style>
.row-eq-height {
display: flex;
flex-wrap: wrap;
}
</style>
<div class="container-fluid">
<div class="row row-eq-height">
<div class="col-xs-4" style="background-color: red;">
some content
</div>
<div class="col-xs-4" style="background-color: yellow;">
catz
<img width="100" height="100" src="https://lorempixel.com/100/100/cats/" alt=>
some more content
Step by Step Execution
Consider this example:
<style>
.row-eq-height {
display: flex;
}
</style>
<div class="row row-eq-height">
<div class="col-xs-4" style="background: red;">Short</div>
<div class="col-xs-4" style="background: yellow;">
Tall content<br>
More content<br>
Even more content
</div>
<div class="col-xs-4" style="background: blue;">Medium</div>
</div>
What happens step by step
- The browser reads the
.row. - Because
.row-eq-heightsets , the row becomes a flex container.
Real World Use Cases
Equal-height columns are useful in many common layouts:
Product cards
E-commerce pages often show products in rows. If one product name is longer than others, equal heights keep the cards aligned.
Pricing tables
Plans such as Basic, Pro, and Enterprise look cleaner when each pricing panel has the same height.
Dashboard widgets
Statistics cards and admin panels often sit in a row. Matching heights makes the UI feel organized.
Feature sections
Marketing or documentation pages may show three features side by side. Equal heights help buttons and footers line up.
Blog or article grids
Preview cards with different text lengths still look balanced when their containers are equal height.
Real Codebase Usage
In real projects, developers usually combine equal-height columns with other layout patterns.
Common patterns
1. Flex row with inner card
A common pattern is:
- Bootstrap column controls width
- inner
.cardor.panelcontrols visuals - Flexbox equalizes the outer column heights
<div class="row row-eq-height">
<div class="col-sm-4">
<div class="card">...</div>
</div>
</div>
2. Stretching card bodies
Sometimes developers also use Flexbox inside each card so buttons stay at the bottom.
.card {
display: flex;
flex-direction: column;
height: 100%;
}
This is useful when cards need equal overall height and aligned internal sections.
3. Responsive behavior
Common Mistakes
1. Assuming Bootstrap 3 does this automatically
Bootstrap 3's grid handles widths, not equal heights.
Mistake
<div class="row">
<div class="col-xs-4">Short</div>
<div class="col-xs-4">Tall content with image</div>
<div class="col-xs-4">Short</div>
</div>
Fix
Add custom CSS such as Flexbox.
.row-eq-height {
display: flex;
}
2. Setting a fixed height
Beginners sometimes do this:
.panel {
height: 200px;
}
This can break when content grows larger than expected.
Better approach
Use equal-height layout instead of hard-coded heights.
Comparisons
| Approach | How it works | Pros | Cons | Best use |
|---|---|---|---|---|
| Flexbox | Makes the row a flex container so columns stretch to equal height | Modern, simple, responsive, CSS-only | Needs custom CSS in Bootstrap 3 | Most projects |
display: table / table-cell | Makes elements behave like table cells | Works in older layouts | Less flexible, less modern | Legacy support |
| Fixed height | Gives every column the same hard-coded height | Very easy to understand | Breaks when content changes | Rarely recommended |
| JavaScript height matching | Measures tallest element and sets others to same height | Can work in older browsers | More code, harder to maintain |
Cheat Sheet
Quick reference
Bootstrap 3 equal-height columns
.row-eq-height {
display: flex;
flex-wrap: wrap;
}
<div class="row row-eq-height">
<div class="col-xs-4">...</div>
<div class="col-xs-4">...</div>
<div class="col-xs-4">...</div>
</div>
Key rules
- Bootstrap 3 columns do not automatically get equal height
- Flexbox is the preferred CSS-only solution
- Use a custom class like
.row-eq-heightinstead of changing every.row - Add
flex-wrap: wrapfor safer responsive behavior - Prefer inner content containers for styling
Common pattern
FAQ
Why are my Bootstrap columns different heights?
Because column height is based on the content inside each column. Bootstrap 3 only controls the grid width, not equal heights.
What is the easiest way to make Bootstrap columns equal height?
Use Flexbox by adding display: flex to the row and applying it through a custom class.
Does Bootstrap 3 support equal-height columns by default?
No. Bootstrap 3 uses a float-based grid, so you need custom CSS.
Can I use height: 100% to fix this?
Usually not by itself. height: 100% only works when the parent has a defined height.
Is JavaScript needed for equal-height columns?
Not in most modern cases. CSS Flexbox is usually enough.
What about Bootstrap 4 or 5?
They use a Flexbox-based grid, so equal-height layouts are easier to build.
Should I give all columns a fixed height?
Usually no. Fixed heights can cause overflow or broken layouts when content changes.
Mini Project
Description
Build a simple three-column feature section in Bootstrap 3 where each column has different content length, but all columns appear the same height. This demonstrates how to combine the Bootstrap grid with custom Flexbox helpers for a cleaner layout.
Goal
Create a responsive row of three equal-height columns using Bootstrap 3 and custom CSS.
Requirements
- Use Bootstrap 3 classes for the three-column layout.
- Add a custom class that makes the row use Flexbox.
- Give each column different amounts of content.
- Make all columns match the height of the tallest column.
- Use separate classes for visual styling instead of relying on
.panel.
Keep learning
Related questions
Angular ngClass Conditional Class Binding Explained
Learn how to use Angular ngClass for conditional classes, fix common binding mistakes, and understand why this template error happens.
CSS :not() Selector for Elements Without a Class or Attribute
Learn how to use the CSS :not() selector to target elements that do not have a specific class or attribute, with examples and common pitfalls.
CSS Font Scaling Relative to Container Size: %, em, rem, vw, and Responsive Text
Learn how CSS font scaling really works and how to make text responsive using %, em, rem, vw, clamp(), and media queries.