如何使按钮在引导程序3中以水平形式与输入对齐?

时间:2014-04-20 07:42:22

标签: twitter-bootstrap twitter-bootstrap-3

<form action="/" class="form-horizontal" method="post">
<div id="div_id_text_input" class="form-group">
    <label for="id_text_input" class="control-label col-md-2">
     Text input<span class="asteriskField">*</span></label>
    <div class="controls col-md-4">
        <input class="input-xlarge textinput textInput form-control" 
               id="id_text_input" name="text_input" type="text" />
    </div>
</div>
<div id="div_id_textarea" class="form-group">
    <label for="id_textarea" class="control-label 
           col-md-2 requiredField">Textarea
    </label>
    <div class="controls col-md-4">
        <textarea class="input-xlarge textarea form-control" cols="40" 
                  id="id_textarea" name="textarea" rows="3"></textarea>
    </div>
</div>
<div class="form-actions">
    <input type="submit" name="save_changes" value="Save changes" 
           class="btn btn-primary btn-primary" id="submit-id-save_changes" />
    <input type="submit" name="cancel" value="Cancel" class="btn btn-primary" 
           id="submit-id-cancel" />
</div>

默认情况下,表单操作按钮与标签保持对齐。 如何使其与输入对齐。

jsFiddle

Result

1 个答案:

答案 0 :(得分:0)

<div class="form-actions">
    <label class="col-md-2 control-label"></label> <!-- Add this line -->
    <input type="submit" name="save_changes" value="Save changes" 
       class="btn btn-primary btn-primary" id="submit-id-save_changes" />

Preview