【发布时间】:2018-12-14 12:08:14
【问题描述】:
我有两列,我想将它们居中,在 boostrap 3 中使用推和拉在 boostrap 4 中很简单,但我无法弄清楚。
这就是我所拥有的。
<div class="col-sm bg-success">1 </div>
<div class="col-sm bg-warning">2 </div>
</div>
我希望这两个 div 像这样居中。
我需要改变什么才能得到我想要的结果?
【问题讨论】:
-
这两列占一行的百分比是多少?使用引导程序 4 将它们居中的方法有很多。您可以使用
max-width和 css 类mx-auto将它们包装在一个 div 中:getbootstrap.com/docs/4.1/utilities/spacing/… -
两者都应该有 col-sm-4
标签: html twitter-bootstrap bootstrap-4