我有这样的表格:
<form role="form" class="form-inline" name="frmUserData" id="frmUserData">
<div class="form-group">
<label for="txtlitm">Item Code:</label>
<input type="text" class="form-control" id="txtlitm" name="txtlitm" autocomplete="off">
</div>
<div class="form-group">
<label for="txtmcu">Branch Plant (filter):</label>
<input type="text" class="form-control" id="txtmcu" name="txtmcu">
</div>
<div class="form-group">
<label for="txtlocn">Location (filter):</label>
<input type="text" class="form-control" id="txtlocn" name='txtlocn'>
</div>
<div class="form-group">
<button type="button" class="pull-left btn btn-default" id="btnGO">
Search
</button>
</div>
</form>
在我启用typeahead.js之后看起来像这样:
项目代码标签未与其他字段的文本框对齐。
我该怎么做才能解决它?
答案 0 :(得分:7)
Typeahead.js将“vertical-align:top”设置为输入元素,这会导致您的问题(请参阅typeahead.bundle.js中的第753行和第758行)
您可以在JS中更改它或通过CSS覆盖它:
.form-inline .form-control {
vertical-align: middle !important;
}
答案 1 :(得分:0)
可能设置列大小将起作用:
<div class="form-group">
<label class="col-sm-2">Item Code:</label>
<div class="col-sm-2">
<input type="text" class="form-control" id="txtlitm" name="txtlitm" autocomplete="off">
</div>
</div>
<div class="form-group">
<label class="col-sm-2">Branch Plant (filter):</label>
<div class="col-sm-2">
<input type="text" class="form-control" id="txtmcu" name="txtmcu">
</div>
</div>
<div class="form-group">
<label class="col-sm-2">Location (filter):</label>
<div class="col-sm-2">
<input type="text" class="form-control" id="txtlocn" name='txtlocn'>
</div>
</div>