我正在创建一个输入表单。第一行包含一列,
第二行包含2列,
第三行包含3列。
每列有标签和输入
当我尝试创建表单时,输入的开始与每一行都不同。
尝试使用align-self-center order-2
,但不起作用
源代码
<div class="row mt-3">
<div class="col-md-12">
<div class="row mb-3">
<div class="col-md-2 col-xs-2">
<label for="Nationality" class="required control-label col-form-label">Nationality</label>
</div>
<div class="col-md-10 col-xs-10 align-self-center order-2">
<input type="text" class="form-control" name="Nationality" id="Nationality" >
</div>
</div>
</div>
</div>
<div class="row justify-content-center mt-3 align-items-center">
<div class="col-md-6">
<div class="row mb-3 justify-content-center">
<div class="col-md-5 col-xs-5">
<label for="maritalStatus" class="required control-label col-form-label">maritalStatus</label>
</div>
<div class="col-md-7 col-xs-7">
<select class="form-control selecting" id="maritalStatus" name="maritalStatus">
<option value=""></option>
<option value="a">a</option>
<option value="b">b</option>
</select>
</div>
</div>
</div>
<div class="col-md-6">
<div class="row mb-3 justify-content-center">
<div class="col-md-5 col-xs-5">
<label for="education" class="required control-label col-form-label">Educaiton</label>
</div>
<div class="col-md-7 col-xs-7">
<select class="form-control selecting" id="education" name="education">
<option value=""></option>
<option value="a">a</option>
<option value="b">b</option>
</select>
</div>
</div>
</div>
</div>
<div class="row justify-content-center mt-3 align-items-center">
<div class="col-md-4">
<div class="row mb-3 justify-content-center">
<div class="col-md-5 col-xs-5">
<label for="GHI" class="required control-label col-form-label">GHI</label>
</div>
<div class="col-md-7 col-xs-7">
<select class="form-control selecting" id="GHI" name="GHI">
<option value=""></option>
<option value="a">a</option>
<option value="b">b</option>
</select>
</div>
</div>
</div>
<div class="col-md-4">
<div class="row mb-3 justify-content-center">
<div class="col-md-5 col-xs-5">
<label for="DEF" class="required control-label col-form-label">DEF</label>
</div>
<div class="col-md-7 col-xs-7">
<select class="form-control selecting" id="DEF" name="DEF">
<option value=""></option>
<option value="a">a</option>
<option value="b">b</option>
</select>
</div>
</div>
</div>
<div class="col-md-4">
<div class="row mb-3 justify-content-center">
<div class="col-md-5 col-xs-5">
<label for="ABC" class="required control-label col-form-label">ABC</label>
</div>
<div class="col-md-7 col-xs-7">
<select class="form-control selecting" id="ABC" name="ABC">
<option value=""></option>
<option value="a">a</option>
<option value="b">b</option>
</select>
</div>
</div>
</div>
</div>
结果
从下面的代码中,我如何使每行的输入开始是垂直对齐的,并使它看起来更好?有没有什么方法可以使用bootstrap中的类来支持它?
2条答案
按热度按时间bbmckpt71#
再添加一个div,并将wrapper类作为父div。同时添加Flex对齐类,用于垂直和水平对齐。给予'height:100 vh;'在 Package 器类中,如下面的代码。
.wrapper {height:100vh;}
9gm1akwq2#
在这里,您需要将所有列添加到一行中并使用列分隔符。然后,为所有标签列添加相同的列宽(例如:
col-md-2
). as Setting one column width标签的文本右对齐....更多更好的外观-示例如下: