Same height column bootstrap 3 row responsive
Solution 1:
You can achieve this by using javascript. Find out the biggest height of the 4 divs and make all of them at the same height like the biggest one.
Here is the code:
$( document ).ready(function() {
var heights = $(".well").map(function() {
return $(this).height();
}).get();
maxHeight = Math.max.apply(null, heights);
$(".well").height(maxHeight);
});
edit history: changed the ',' sign into ';' sign
Solution 2:
There was at one point an official experimental example of same-height columns using CSS flexbox with Bootstrap. Here's the gist of it:
.row-eq-height {
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
}
And then use <div class="row row-eq-height">
instead of <div class="row">
.
Note that flexbox isn't supported in IE<10.
Solution 3:
FYI - I did this to solve my issue to include responsive breakpoints which match the breakpoints in bootstrap. (I use LESS variables from bootstrap to synchronise the breakpoints but below is the compiled css version)
@media (min-width: 0px) and (max-width: 767px) {
.fsi-row-xs-level {
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
}
}
@media (min-width: 768px) and (max-width: 991px) {
.fsi-row-sm-level {
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
}
}
@media (min-width: 992px) and (max-width: 1199px) {
.fsi-row-md-level {
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
}
}
@media (min-width: 1200px) {
.fsi-row-lg-level {
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
}
}
then added the classes to the parent which were required.
<div class="row fsi-row-lg-level fsi-row-md-level">
<div class="col-sm-4">column 1</div>
<div class="col-sm-4">column 2</div>
<div class="col-sm-4">column 3</div>
</div>