[英]Thumbnails using twitter bootstrap not vertically aligned
Here's my sample output: 这是我的示例输出:
Here's my html
code on it: 这是我的
html
代码:
<div class="products">
<ul class="thumbnails">'
<li>
<div>'.$item->ASIN.'</div>
<div><img src="'.$item->SmallImage->URL.'" alt=""></div>
<div>'.$item->ItemAttributes->Title.'</div>
<div>'.$item->ItemAttributes->ProductGroup.'</div>
</li>
</ul>
And here's my css
code: 这是我的
css
代码:
.thumbnails {
text-align: center;
}
.thumbnails li {
width: 150px;
height: 250px;
background: red;
float: none !important; /* to overwrite the default property on the bootstrap stylesheet */
display: inline-block;
*display: inline; /* ie7 support */
zoom: 1;
}
I noticed it is already horizontally aligned, my problem is to align it vertically. 我注意到它已经水平对齐了,我的问题是垂直对齐了。 What should I do?
我该怎么办? Please help thanks!
请帮忙谢谢!
I know its a little late but not sure if this helps - http://getbootstrap.com/css/#grid-responsive-resets 我知道有点晚了,但不确定是否有帮助-http: //getbootstrap.com/css/#grid-sensitive-resets
<div class="row">
<div class="col-xs-6 col-sm-3">.col-xs-6 .col-sm-3</div>
<div class="col-xs-6 col-sm-3">.col-xs-6 .col-sm-3</div>
<!-- Add the extra clearfix for only the required viewport -->
<div class="clearfix visible-xs"></div>
<div class="col-xs-6 col-sm-3">.col-xs-6 .col-sm-3</div>
<div class="col-xs-6 col-sm-3">.col-xs-6 .col-sm-3</div>
</div>
Thanks, 谢谢,
Ash. 灰。
Wrap it with a row or container. 用行或容器包装。
<div class="products">
<div class="container">
<ul class="thumbnails">'
<li>
<div>'.$item->ASIN.'</div>
<div><img src="'.$item->SmallImage->URL.'" alt=""></div>
<div>'.$item->ItemAttributes->Title.'</div>
<div>'.$item->ItemAttributes->ProductGroup.'</div>
</li>
</ul>
</div>
</div>
There are two ways to make this better that I've found: manually setting the element height / keeping the element heights consistent, OR the following CSS: 我发现有两种方法可以改善这种情况:手动设置元素高度/保持元素高度一致,或者使用以下CSS:
.thumbnails > li {
float: left;
overflow: hidden;
text-overflow: ellipsis;
}
.thumbnails > li:nth-child(3n+4) {
clear: both;
}
Wrapping this in a container won't fix the problem; 将其包装在容器中无法解决问题。 it'll just constrain it to a smaller space.
它只会将其限制在较小的空间中。
Similar issues: 类似问题:
vertically aligning thumbnails in bootstrap css? 在bootstrap CSS中垂直对齐缩略图?
Aligning thumbnails along columns using twitter-bootstrap 使用twitter-bootstrap将缩略图沿列对齐
twitter bootstrap thumbnails not aligning properly anywhere but Chrome + Windows XP Twitter引导程序缩略图在Chrome + Windows XP之外的任何地方均无法正确对齐
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.