I'm using Bootstrap. How can I make three columns all the same height?
Here is a screenshot of the problem. I would like the blue and red columns to be the same height as the yellow column.
Here is the code:
<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/">
</div>
<div class="col-xs-4 panel" style="background-color: blue">
some more content
</div>
</div>
</div>
HTML
CSS
JS
Just checking through bootstrap documentation and I found the simple solution for the problem of column same height.
Add the extra clearfix for only the required viewport
For example:
Please refer to http://getbootstrap.com/css/#grid-responsive-resets
There is a problem with using Solution 1 while appling it on only column in rows. Would like to improve Solution 1.
(Sorry, can't comment Popnoodles's anwer. I have not enough reputations)
If you want to make this work in any browser, use javascript:
If anyone using bootstrap 4 and looking for equal height columns just use
row-eq-height
to parent divRef: http://getbootstrap.com.vn/examples/equal-height-columns/
Solution 1 using negative margins (doesn't break responsiveness)
Demo
Solution 2 using table
Demo
Solution 3 using flex added August 2015. Comments posted before this don't apply to this solution.
Demo