Possible Duplicate:
CSS – Equal Height Columns?
I have 3 divs.
Like this:
<div class="features"></div>
<div class="features"></div>
<div class="features"></div>
They are going to be filled with text. I’m not sure how much. The thing is, it’s imperative that they are all equal heights.
How can i use jQuery (or CSS) to find the tallest of the DIV’s and set the other two to the same height, creating 3 equal height DIV’s.
Is this possible?
You can’t easily select by height or compare in CSS, but jQuery and a few iterations should easily take care of this problem. We’ll loop through each element and track the tallest element, then we’ll loop again and set each element’s height to be that of the tallest (working JSFiddle):
[Addendum]
Sheriffderek has crafted a JSFiddle for this solution in a responsive grid. Thanks!
[Version 2]
Here is a cleaner version using functional programming:
[Version 3 – sans jQuery]
Here’s an updated version that doesn’t use jQuery (working JSFiddle):
(and here it is in ES6)