如何在 Twitter Bootstrap 3 中居中按钮? [英] How to center buttons in Twitter Bootstrap 3?
本文介绍了如何在 Twitter Bootstrap 3 中居中按钮?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在 Twitter Bootstrap 中构建一个表单,但我在将按钮居中放置在表单输入下方时遇到问题.我已经尝试将 center-block
类应用于按钮,但没有奏效.我应该如何解决这个问题?
这是我的代码.
<div class="form-group"><label class="col-md-4 control-label" for="singlebutton"></label><div class="col-md-4"><button id="singlebutton" name="singlebutton" class="btn btn-primary center-block">下一步!按钮>
解决方案
使用text-center"类将 Button 包裹在 div 中.
只要改变这个:
<div class="col-md-4 center-block"><button id="singlebutton" name="singlebutton" class="btn btn-primary center-block">下一步!</button>
对此:
<div class="col-md-4 text-center"><button id="singlebutton" name="singlebutton" class="btn btn-primary">下一步!</button>