Equal Column Height
08
July
2015

It is so much better if the columns are aligned by height when we are creating column based layout.

var max_height = 0;
$("div.colheight").each(function(){
if ($(this).height() > max_height) { max_height = $(this).height(); }
});
$("div.col").height(max_height);

Here in this example the first div with class name colheight is having height of 200px. While the second div will have same class name colheight but no height is specified for that div but it also takes the height as 200px

<div class="colheight" style="height: 200px;"></div>
<div class="colheight"></div>
  • 654 View
  • Pin It