【发布时间】:2017-01-22 09:03:06
【问题描述】:
我已密切关注the most popular example 如何在列之间添加空格,但它不起作用。您可以在
上查看它的实际效果我所做的是在每列的col-sm-4 中放置一个col-sm-12。根据most popular answer here,这应该会自动在 2 个 div 之间呈现一些空间。
HTML:
<div class="row blocks-grid">
<div class="col-xs-6 col-sm-4 item">
<div class="col-sm-12">
<img src="http://example.com/1MBVDF4">
<h2>This is me</h2>
</div>
</div>
<div class="col-xs-6 col-sm-4 item">
<div class="col-sm-12">
<img src="http://example.com/1MBVDF4">
<h2>This is me</h2>
</div>
</div>
<div class="col-xs-6 col-sm-4 item">
<div class="col-sm-12">
<img src="http://example.com/1MBVDF4">
<h2>This is me</h2>
</div>
</div>
</div>
CSS:
body {
background: #BEB7A4;
}
.blocks-grid {
max-width:75.0rem;
margin:0 auto;
.item {
cursor: pointer;
margin-bottom:1rem;
position:relative;
height:34.0rem;
padding-top:2.5rem;
background:#FFFFFC;
&:hover {
background:#FF0000;
color:white;
img {
display:none;
}
}
h2 {
font-size:2.0rem;
margin-top:1rem;
text-align: center;
}
img {
max-width: 100%;
margin:auto;
display:block;
}
}
}
基本上,我认为结果应该如下图所示,但事实并非如此:
【问题讨论】:
-
您是否正在寻找仅适用于某些列或所有列的解决方案?
标签: html css twitter-bootstrap