dan*_*aka 27 html css twitter-bootstrap
免责声明.这个问题被问很多之前倍.但是由于时间已经过去,现在我们接近Bootstrap 4发布并且支持完整的flexbox,现在是时候为同一个问题找到新的答案了.
我想用Bootstrap 4创建相等的列高度.这是预期结果的演示:

我想要一个适用于Bootstrap 4支持的所有浏览器的解决方案.如果没有涉及JS,那就更好了.一些现有的解决方案基于Bootstrap 3,有些不适用于MacOS上的Safari.
更新.似乎我做错了研究.默认情况下,Bootstrap 4的高度相同.我已经包含了一个带有插图的更新图像.你不需要做任何事情,它已经存在了.
neo*_*yte 28
您只需使用class="row-eq-height"您的class="row"以获得相同高度的列以用于以前的引导版本.
但是使用bootstrap 4本身就是这样.
检查此链接--http://getbootstrap.com.vn/examples/equal-height-columns/
Que*_*tin 12
等高列是Bootstrap 4网格的默认行为.
.col { background: red; }
.col:nth-child(odd) { background: yellow; }Run Code Online (Sandbox Code Playgroud)
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" integrity="sha384-rwoIResjU2yc3z8GV/NPeZWAv56rSmLldC3R/AZzGRnGxQQKnKkoFVhFQhNUwEyJ" crossorigin="anonymous">
<div class="container">
<div class="row">
<div class="col">
1 of 3
</div>
<div class="col">
1 of 3
<br>
Line 2
<br>
Line 3
</div>
<div class="col">
1 of 3
</div>
</div>
</div>Run Code Online (Sandbox Code Playgroud)
您可以使用新的 Bootstrap 卡:
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" integrity="sha384-rwoIResjU2yc3z8GV/NPeZWAv56rSmLldC3R/AZzGRnGxQQKnKkoFVhFQhNUwEyJ" crossorigin="anonymous">
<script src="https://code.jquery.com/jquery-3.1.1.slim.min.js" integrity="sha384-A7FZj7v+d/sdmMqp/nOQwliLvUsJfDHW+k9Omg/a/EheAdgtzNs3hpfag6Ed950n" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/tether/1.4.0/js/tether.min.js" integrity="sha384-DztdAPBWPRXSA/3eYEEUWrWCy7G5KFbe8fFjk5JAIxUYHKkDx6Qin1DkWx51bBrb" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/js/bootstrap.min.js" integrity="sha384-vBWWzlZJ8ea9aCX4pEW3rVHjgjt7zpkNpZk+02D9phzyeVkE+jo0ieGizqPLForn" crossorigin="anonymous"></script>
<div class="card-group">
<div class="card">
<img class="card-img-top" src="..." alt="Card image cap">
<div class="card-block">
<h4 class="card-title">Card title</h4>
<p class="card-text">This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p>
</div>
<div class="card-footer">
<small class="text-muted">Last updated 3 mins ago</small>
</div>
</div>
<div class="card">
<img class="card-img-top" src="..." alt="Card image cap">
<div class="card-block">
<h4 class="card-title">Card title</h4>
<p class="card-text">This card has supporting text below as a natural lead-in to additional content.</p>
</div>
<div class="card-footer">
<small class="text-muted">Last updated 3 mins ago</small>
</div>
</div>
<div class="card">
<img class="card-img-top" src="..." alt="Card image cap">
<div class="card-block">
<h4 class="card-title">Card title</h4>
<p class="card-text">This is a wider card with supporting text below as a natural lead-in to additional content. This card has even longer content than the first to show that equal height action.</p>
</div>
<div class="card-footer">
<small class="text-muted">Last updated 3 mins ago</small>
</div>
</div>
</div>Run Code Online (Sandbox Code Playgroud)
链接:点击这里
问候,
| 归档时间: |
|
| 查看次数: |
80512 次 |
| 最近记录: |