答案 0 :(得分:1)
您可以使用vh
css单位为每列指定视口高度。
<强> HTML:强>
<div class="container-fluid">
<div class="row">
<div class="col-sm-6">1</div>
<div class="col-sm-6">2</div>
<div class="col-sm-6">3</div>
<div class="col-sm-6">4</div>
<div class="col-sm-6">5</div>
<div class="col-sm-6">6</div>
</div>
</div>
<强> CSS:强>
@media (min-width: 768px) {
.col-sm-6 {
height: 33.33vh;
}
}
.container-fluid .col-sm-6 {
border: 1px solid black;
background: green;
height: 100vh;
color: white;
}
@media (min-width: 768px) {
.container-fluid .col-sm-6 {
height: 33.33vh;
}
}
&#13;
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<div class="container-fluid">
<div class="row">
<div class="col-sm-6">1</div>
<div class="col-sm-6">2</div>
<div class="col-sm-6">3</div>
<div class="col-sm-6">4</div>
<div class="col-sm-6">5</div>
<div class="col-sm-6">6</div>
</div>
</div>
&#13;
答案 1 :(得分:1)
<div class="container-fluid">
<div class="row">
<div class="col-md-6 sameHeight">
</div>
<div class="col-md-6 sameHeight">
</div>
<div class="col-md-6 sameHeight">
</div>
<div class="col-md-6 sameHeight">
</div>
<div class="col-md-6 sameHeight">
</div>
<div class="col-md-6 sameHeight">
</div>
</div>
</div>
你可以使用这样的twitter bootstrap类,并为每个div提供相同的高度。
.sameHeight{
height:30px;
}