In Bootstrap, is there an easy way to make all the span elements in a row the same height, i.e. the height of the tallest element?
Here's an example of what I mean.
http://jsfiddle.net/DVnZ6/
As of 2017, the best (and easiest) way to make equal height columns in a responsive design is using CSS3 flexbox. Now we have columns that are equal in height, and their content fills the full height ot the entire column.
You can use Jquery's Equal Heights Plugin to accomplish, this plugins makes all the div of exact same height as other. If one of them grows and other will also grow.
Place both DIVs into a container DIV that's set to 100% of page height and set both interior DIVS to 100%. They will fill up the container DIV and the height of both will be equal.
Answer: Use the CSS3 flexbox With CSS3 flex layout model you can very easily create the equal height columns or <div> elements that are aligned side by side. Just apply the display property with the value flex on the container element and the flex property with the value 1 on child elements.
You can do it using jQuery:
boxes = $('.well');
maxHeight = Math.max.apply(
Math, boxes.map(function() {
return $(this).height();
}).get());
boxes.height(maxHeight);
Here's an example: http://jsfiddle.net/DVnZ6/3/
The resize event would have to be added to this code since the height of the content in most cases varies on different resolutions and that produces unwanted design problems like overflowed text.
Here's an more complete version of the code that supports resizing as well
jQuery(function () {
equalMaxWidth = 500; /* Customize viewport width - for resolutions below this number, the height equalizing will not work */
boxes = jQuery('.well');
boxes.removeAttr('style');
if(jQuery(window).width() > equalMaxWidth){
equalBoxHeights(boxes);
};
window.onresize = function () {
boxes.removeAttr('style');
console.log( jQuery(window).width());
if(jQuery(window).width() > equalMaxWidth){
equalBoxHeights(boxes);
};
};
});
function equalBoxHeights(boxes) {
maxHeight = Math.max.apply(
Math, boxes.map(function () {
return jQuery(this).height();
}).get());
boxes.height(maxHeight);
}
Check the demo on jsFiddle http://jsfiddle.net/o4w7tjtz/
Tip: try resizing the 3rd vertical frame (noticed equal heights on around 500pw width ?)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With