在做一些研究时,我发现我遇到了与此处完全相同的问题:Bootstrap columns not aligning correctly .
除了我不能使用相同的解决方案,因为列是通过 ng-repeat 循环添加的,我无法预测它们的高度或会有多少。
当一个比其他的高一点时,它们不能正确堆叠,您建议如何解决这个问题?
相关代码( Controller 只是填充产品数组):
<div class="col-sm-2 text-center" ng-repeat="product in products">
<img class="img-responsive img-center" src="{{product.image}}" alt="">
<h4>
<a href="#/list/{{product.product_id}}">{{product.name}}</a>
</h3>
<p>Price: {{product.price}}€</p>
</div>
谢谢!
最佳答案
您可以使用像 Masonry 或 Isotope 这样的 jQuery 插件,这将使图像无论高度如何都适合。或者您可以像这个例子一样尝试 CSS 3 列宽:http://www.codeply.com/go/Ndk9jqofgR
关于html - Bootstrap 列未正确对齐,AngularJS 循环,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30969922/