<分区>
我想将 col-md-12
中的 div 垂直居中。这是结构:
.list-item {
border-bottom: 1px solid #e7e7e7;
float: left;
padding: 15px 0;
width: 100%;
}
.list-item img {
width: 60px;
height: 60px;
}
.col-md-2 {
float: left;
width: 16.66666667%;
}
<div class="list-item col-md-12 clearfix">
<div class="col-md-1">
<img class="img-circle" src="https://aframe.io/aframe/examples/_skies/puydesancy.jpg">
</div>
<div class="col-md-2">
<strong>
<a href="#/buildings/1">Central park</a>
</strong>
</div>
<div class="col-md-5">
<span>The description for central park description for the central park</span>
</div>
<div class="col-md-2">
<span>Category count:</span>
<strong>3</strong>
</div>
<div class="col-md-2">
<span>Panorama count:</span>
<strong>7</strong>
</div>
</div>
我尝试了:vertical-align: middle
和 display: inline
但没有用。还有别的办法吗?
这是 JSFiddle:https://jsfiddle.net/wLgfLo3L/
(您需要将浏览器调整为全屏)。