我有 2 个 div(每个 6 列)。左边的div是一张图片,右边的div是一些引用。我希望我的右侧 div 的高度与图像的高度相同。
这是我的代码:http://codepen.io/matysflance/pen/PZXdBK
<div id="testimonials" class="container-fluid testimonials">
<div class="row">
<div class="col-lg-6 image">
<img src="http://placehold.it/1100x700/f3e42a" alt="">
</div>
<div class="col-lg-6 quote">
<blockquote>
<p>"Integer posuere erat a ante venenatis dapibus posuere veit al..." </p>
<cite>Susan Sims, Interaction Designer at XYZ</cite>
</blockquote>
</div>
</div>
</div>
最佳答案
你可以使用 jQuery 做到这一点
只需将 same-height
类添加到您想要具有相同高度的 DIV 中
jQUERY
jQuery(document).ready(function($) { //noconflict wrapper
var heights = $(".same-height").map(function() {
return $(this).height();
}).get(),
maxHeight = Math.max.apply(null, heights);
$(".same-height").height(maxHeight);
});
关于jquery - 两个div的高度相等,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35342576/