【发布时间】:2023-03-11 11:08:02
【问题描述】:
我有一个使用 Bootstrap 4.4 的表单。 The form groups contain a label and an input and sometimes also a select and when the select is present it breaks the alignment of the labels and inputs on the same row.
如何让标签始终在顶部,输入在底部?如果可能的话,我想在没有自定义 Css 和其他 html 元素的情况下执行此操作。
<div class="row col-sm-12 col-md-12 col-lg-12">
<div class="col-sm-12 col-md-3 col-lg-3 form-group">
<label for="value">Value:</label>
<select>
<option>something</option>
</select>
<div class="input-group">
<input type="text" class="form-control">
</div>
</div>
<div class="col-sm-12 col-md-3 col-lg-3 form-group">
<label for="name">Name:</label>
<div class="input-group">
<input type="text" class="form-control">
</div>
</div>
</div>
在其中一个容器上使用 justify,我将所有输入对齐到底部,但我想将标签保留在顶部。
【问题讨论】:
标签: html css bootstrap-4