如何在Bootstrap 3模式中居中输入?

时间:2013-09-09 18:07:25

标签: html twitter-bootstrap-3

我目前正在从bootstrap 2切换到Bootstrap 3.如何将Bootstrap 3中的输入字段居中?文本中心正确。它曾经适用于BS2。我试过在div中移动'style ='text-align:center',但仍然没有运气。

JSfiddle

Updated fiddle with answer

    <div id="Email_Alert_Modal" class="modal show" tabindex="-1" role="dialog" data-keyboard="false" data-backdrop="static">
    <div class="modal-dialog">
        <div class="modal-content">

            <div class="modal-header" style="text-align: center">
               <h3>Email Alert</h3>
            </div>

            <div class="modal-body"  style="text-align: center">
                    <h4>Please enter email address that the alert will be sent to.</h4>
                    <label  for="send_email"> </label> <input style="width:200px" type="email"  class="form-control" name="email" id="send_email" placeholder="johndoe@yahoo.com"  title="Input Email Address">
            </div>

            <div class="modal-footer">
              <button class="btn btn btn-primary" onclick='Email_Alert()' >Send</button>
              <button class="btn btn btn" data-dismiss="modal" >Cancel</button>
            </div>
        </div>
    </div>
</div>

1 个答案:

答案 0 :(得分:12)

设置

margin: 0 auto;

表示输入元素