[英]How can I align my checkbox with css?
I need to do a form with checkboxes and a list. 我需要做一个带有复选框和列表的表格。 I used Bootstrap for my checkbox and list, but the problem is that the text and the checkbox are unaligned.
我将Bootstrap用于我的复选框和列表,但是问题是文本和复选框未对齐。
<div id="ContForm">
<div id="Cajamitad1">
<div class="checkbox">
<label>
<input type="checkbox" value="">Soy Vegano
</label>
</div>
<div class="checkbox">
<label>
<input type="checkbox" value="">Soy diabetico
</label>
</div>
</div>
<div id="Cajamitad2">
<select class="form-control">
<option>1</option>
<option>2</option>
</select>
</div>
</div>
How can I align them? 如何对齐它们?
You can use the classes provided by bootstrap.css
like form-control
or you can try this: 您可以使用
bootstrap.css
提供的类(例如form-control
,也可以尝试以下操作:
input {
vertical-align: middle;
line-height: 1;
}
This CSS ruleset says, "Every input element will be vertically aligned to the middle, and has the equivalent height of an uppercase letter." 这个CSS规则集说: “每个输入元素都将垂直对齐到中间,并且具有与大写字母等效的高度。”
input { vertical-align: middle; line-height: 1; }
<div id="ContForm"> <div id="Cajamitad1"> <div class="checkbox"> <label> <input type="checkbox" value="">Soy Vegano </label> </div> <div class="checkbox"> <label> <input type="checkbox" value="">Soy Diabetico </label> </div> </div> <div id="Cajamitad2"> <select> <option>1</option> <option>2</option> </select> </div> </div>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.