我有以下表單,我的按鈕是一個圖像按鈕。我希望與電子郵件輸入處於同一行,但我無法弄清楚如何完成它。我將按鈕向右移動,但不與輸入欄位對齊。如何使按鈕在輸入表單旁邊浮動?
形式:
.control-group{
float:left;
}
.control-group.button{
clear:both;
}
<form class="well email-form" id="emailForm" name="sendEmail" novalidate="" method="post">
<div class="col-sm-6">
\t <div class="control-group">
\t <div class="field-control">
\t <input class="form-control" name="email" id="email-address" type="email" placeholder="ENTER EMAIL ADDRESS" required="" data-validation-required-message=" "/>
\t </div>
\t </div>
\t <div class="control-group button">
\t <div class="field-control">
\t \t <input type="image" src="http://placehold.it/25x25" name="submitEmail" class="button"/>
\t </div>
\t </div>
</div>
</form>
CSS:
.control-group{
float:left;
}
.control-group.button{
clear:both;
}
擺脫了明確的呢? – j08691 2014-11-03 17:03:59
它的工作,我認爲,因爲div是一個塊,我不得不使用清除並排對齊 – Arwen 2014-11-03 17:06:12
清除一個元素意味着它將向下移動到浮動元素下方。 – j08691 2014-11-03 17:07:10