我想创建一个表单,旁边有一个复选框。目前,它看起来像这样:
因此,复选框与表单的标签对齐,即它们在顶部对齐,但我希望两者在底部对齐。
应该怎么做?
这是我的代码:
<!DOCTYPE html>
<html lang="en">
<head>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
<link href="https://cdn.datatables.net/1.10.16/css/jquery.dataTables.min.css" rel="stylesheet">
</head>
<body>
<div class="container">
<div class="header">
<h3 class="text-muted">Select something!</h3>
</div>
<div class="row">
<div class="form-group col-xs-6">
<label for="some_selection">Select something</label>
<select class="form-control" id="some_selection">
<option selected>--None--</option>
<option>foo</option>
<option>bar</option>
</select>
</div>
<div>
<input class="form-check-input" type="checkbox" value="" id="some_id">I should be far lower
</div>
</div>
</div>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</body>
</html>
答案 0 :(得分:2)
试试这个
<div class="container">
<div class="header">
<h3 class="text-muted">Select something!</h3>
</div>
<div class="row">
<div class="form-group col-xs-12">
<label for="some_selection">Select something</label>
</div>
<div class="col-xs-6">
<select class="form-control" id="some_selection">
<option selected>--None--</option>
<option>foo</option>
<option>bar</option>
</select>
</div>
<div class="col-xs-6">
<input class="form-check-input" type="checkbox" value="" id="some_id">I should be far lower
</div>
</div>
</div>