I want to make all the columns to same height in a row. So, all columns in a row should have the same height as any column with max height.
Fiddler: https://jsfiddle.net/ebwwvy6m/11/
<div class="container-fluid">
<div class="row">
<div class="col-sm-2 bg-warning">
This is a col-sm-2
Some test content
Some test content
Some test content
Some test content
</div>
<div class="col-sm-6 bg-success">
.col-sm-6
</div>
<div class="col-sm-4 bg-info">
.col-sm-4
Some test content
Some test content
</div>
</div>
</div>
Issue:
Both column 2 and column 3 should expand to have the same height as column 1.
Any help / suggestion will be greatly appreciated.
4
Answers
Add your own class and set height.
Option 1 (for the layzy)
Option 2: give the col’s id, grab said DOMelement by their Id’s in JavaScript. Then check for the biggest of them all, and use that value to set the (min-)height for all.
The best way to do this is using
display:flex;
on the parentrow
and on thecol
.Working Demo.
Since
flextbox
is a new CSS feature check the browser compatibility: caniuse.comAnd use the
vendor prefix
:If you want to know more about
display:flex;
read this: https://css-tricks.com/snippets/css/a-guide-to-flexbox/P.S. The new bootstrap v4 will have this feature integrated.
Add this class with your row class.
https://jsfiddle.net/ebwwvy6m/16/