如何使用 Bootstrap 将按钮居中对齐 [英] How to align button to center using Bootstrap
问题描述
我使用 Bootstrap 创建了一个磁贴.在磁贴内部,靠近底部的位置我想要磁贴的三个按钮(开始、中间和结束).
我制作了开始和结束按钮,但使用了两个带有 pull-left
和 pull-right
类的 div
标签.现在我想要的是放置中间按钮.
这是我的部分代码和屏幕截图:
<div class="pull-left"><button class="btn btn-primary btn-sx" type="button">确认</button><!-- 我想要另一个按钮,在磁贴的中心--><div class="pull-right"><button class="btn btn-primary btn-xs pull-right" type="button">Decline</button>
Bootstrap 最强大的功能之一是嵌套 row
元素.每个 col-*
容器内部可以有另一个 row
,然后提供另一组完整的 12 个 col
空格:
<div class="row"><div class="col-xs-4"><button class="btn btn-primary btn-sx" type="button">确认</button><div class="col-xs-4"><button class="btn btn-primary btn-xs" type="button">中间按钮</button>
<div class="col-xs-4"><button class="btn btn-primary btn-xs" type="button">Decline</button>