更新时间:2022-11-01 23:41:12
使用最新版本(Bootstrap 4 alpha 6).
Using the lastest version (Bootstrap 4 alpha 6).
使用 align-items-center
类在垂直方向上居中, text-center
在水平方向上居中...
Use the align-items-center
class to vertically centter, and text-center
to horizontal center...
<div class="row text-center align-items-center" style="height:200px;background-color:grey">
<div class="col-md-10">
<span>How to center this vertically/horizontally</span>
</div>
<div class="col-md-2">
<span>This too</span>
</div>
</div>