【发布时间】:2021-05-08 20:47:27
【问题描述】:
我有一个名为严重性的复选框组,它们分为 2 行,每行 3 个复选框。
但是,复选框的垂直对齐方式不太正确。
我需要在一行中有未分类、警告和高,其他在此行之下。
我使用额外的空 div 来划分它们,有没有更好的方法来实现这一点。 以及如何将复选框与引导程序正确对齐。
Currently Missaligned Screenshot
如您所见,警告和平均值未对齐。
<div class="form-group">
<label for="name" class="col-sm-4 control-label">Severity</label>
<div class="col-sm-8">
<div class="checkbox-inline">
<input class="form-check-input" type="checkbox" id="severity_0" name="severity[]" value="0">
<label class="form-check-label" for="severity_0">Not classified</label>
</div>
<div class="checkbox-inline">
<input class="form-check-input" type="checkbox" id="severity_2" name="severity[]" value="2">
<label class="form-check-label" for="severity_2">Warning</label>
</div>
<div class="checkbox-inline">
<input class="form-check-input" type="checkbox" id="severity_4" name="severity[]" value="4">
<label class="form-check-label" for="severity_4">High</label>
</div>
<div></div>
<div class="checkbox-inline">
<input class="form-check-input" type="checkbox" id="severity_1" name="severity[]" value="1">
<label class="form-check-label" for="severity_1">Information</label>
</div>
<div class="checkbox-inline">
<input class="form-check-input" type="checkbox" id="severity_3" name="severity[]" value="3">
<label class="form-check-label" for="severity_3">Average</label>
</div>
<div class="checkbox-inline">
<input class="form-check-input" type="checkbox" id="severity_5" name="severity[]" value="5">
<label class="form-check-label" for="severity_5">Disaster</label>
</div>
</div>
</div>
【问题讨论】:
-
Bootstrap 的哪个版本? Bootstrap 4 有表单检查类:getbootstrap.com/docs/4.0/components/forms/#default-stacked
-
嗨 @NathanielFlick 它的版本 4.1.3
标签: html css twitter-bootstrap