我有按鈕和在HTML文本輸入的水平形式,採用自舉3未對齊形式組與組件的引導CSS其餘
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css" rel="stylesheet"/>
<form role="form" method="post" class="form-horizontal form" >
<div class="container-fluid">
<div class="row" >
<div class="col-md-12" >
<div class="form-group" >
<label class="col-md-1 control-label" for="username" >User Name</label>
<div class="col-md-6" >
<input class="form-control" type="text" id="username" name="username" />
</div>
</div>
<div class="col-md-offset-1" >
<div class="form-group" >
<button class="btn-warning btn" type="button" id="add" name="add" >Add User</button>
</div>
</div>
</div>
</div>
</div>
</form>
如果我把內部的按鈕form-group,按鈕與其他組件不對齊,因此:
.form-horizontal .form-group {
margin-right: -15px;
margin-left: -15px;
}
(您可以在全屏中看到它)
我該如何解決這個問題?我需要創建一個自定義類嗎?
第一個示例僅在這是最後一個「形式組「。如果你有兩排按鈕,他們會在一起(表格組也有一個底部填充) – 2014-12-11 13:32:57
第二個例子是我需要的。我嘗試過,但我只包括col-offset。使用大小和偏移量類將解決此問題。謝謝 – 2014-12-11 13:33:54