The following picture is my product show. I use Bootstrap 3.2
and the whole page is within a <div class="col-xs-12">
element and you can see the dynamically generated html code at the bottom of the image.
My problem is that the product-container
divs don't have same heights (look at the highlighted photo).
Is it possible to fix all heights as same which doesn't affect responsiveness?
You can use Jquery's Equal Heights Plugin to accomplish, this plugins makes all the div of exact same height as other.
The two or more different div of same height can be put side-by-side using CSS. Use CSS property to set the height and width of div and use display property to place div in side-by-side format. The used display property are listed below: display:table; This property is used for elements (div) which behaves like table.
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.
Answer: Set the 100% height for parents too And we all know that the default value of the height property is auto , so if we also set the height of <body> and <html> elements to 100%, the resulting height of the container div becomes equal the 100% height of the browser window.
A few lines of jQuery can solve this:
var maxHeight = 0;
$(".box").each(function () {
if ($(this).height() > maxHeight) {
maxHeight = $(this).height();
}
});
$(".box").height(maxHeight);
(Replace .box
with the class of the divs you want to equalize.)
Heres a quick jsfiddle to show how it works.
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