Consider this markup:
<div class="row">
<div class="col-xs-4">
<img src="somesource.png">
</div>
<div class="col-xs-6">
<h1>Some text</h1>
</div>
<div class="col-xs-2">
<span class="glyphicon glyphicon-chevron-right"></span>
</div>
</div>
If the image is around 100px
in height and the rest is less. How are you supposed to properly set them to equal height without setting a hard coded valued height
property on all of them?
The columns should be able to have absolute
positioned elements inside them and still be equal height as the rest of the columns.
I tried writing a script for this, however, no matter what I did the height of the columns never got the correct value. The script looks like this:
var highest = 0,
columns = $('.row').find('> div[class*="col"]');
$.each(columns, function() {
var height = $(this).height();
if (height > highest) {
highest = height;
}
});
$.each(columns, function() {
$(this).css('height', highest + 'px');
});
However, this script seems to pick the lowest height and then apply that height to all the .col
s.
Why isn't this working the way it should be? And isn't there a better way than doing it like this?
If possible, is there a pure CSS way of obtaining this behavior? Preferably without using table-like CSS rules.