如何中心按钮在Twitter Bootstrap 3? [英] How to center buttons in Twitter Bootstrap 3?

查看:83
本文介绍了如何中心按钮在Twitter Bootstrap 3?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Twitter Bootstrap中创建一个表单,但是我有问题,在表单中的输入下方的按钮。我已经尝试应用 center-block 类到按钮,但是没有工作。




$ b

这是我的代码。

<! - Button - >
< div class =form-group>
< label class =col-md-4 control-labelfor =singlebutton>< / label>
< div class =col-md-4>
< button id =singlebuttonname =singlebuttonclass =btn btn-primary center-block>
下一步!
< / button>
< / div>
< / div>


解决方案

The Below Snippet will work



只是更改

 < div class =col-md-4 center-block > 
< button id =singlebuttonname =singlebuttonclass =btn btn-primary center-block>
下一步!
< / button>
< / div>

用text-center类将div包装到div

 < div class =col-md-4 text-center> 
< button id =singlebuttonname =singlebuttonclass =btn btn-primary>下一步!< / button>
< / div>


I am building a form in Twitter Bootstrap but I'm having issues with centering the button below the input in the form. I have already tried applying the center-block class to the button but that didn't work. How should I fix this?

Here is my code.

<!-- Button -->
<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">
            Next Step!
        </button>
    </div>
</div>

解决方案

The Below Snippet will work

just change

<div class="col-md-4 center-block">
    <button id="singlebutton" name="singlebutton" class="btn btn-primary center-block">
        Next Step!
    </button>
</div>

Wrap the Button in div with "text-center" class

<div class="col-md-4 text-center"> 
<button id="singlebutton" name="singlebutton" class="btn btn-primary">Next Step!</button> 
</div>

这篇关于如何中心按钮在Twitter Bootstrap 3?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆