我试图弄清楚如何将所有输入的左侧对齐在一起。现在整个 .element 行都向左对齐,所以所有的输入字段都是交错的。我不希望输入错开我希望标签文本向右对齐并且输入全部对齐。我尝试了一堆随机的 CSS,但我似乎无法弄清楚。有任何想法吗?
<form>
<div class="element"><label>Name:</label><input name="Name" type="text" /></div>
<div class="element"><label>Email:</label><input name="Email" type="text" /></div>
<div class="element"><label>Phone:</label><input name="Phone" type="text" /></div>
<div class="element"><label>Address Line 1:</label><input name="Address1" type="text" /></div>
<div class="element"><label>Address Line 2:</label><input name="Address2" type="text" /></div>
<div class="element"><label>City:</label><input name="City" type="text" /></div>
<div class="element"><label>State:</label><input name="State" type="text" /></div>
<div class="element"><label>Zip Code:</label><input name="ZipCode" type="text" /></div>
<div class="element"><label>Birth Date:</label><input name="Bdate" type="text" /></div>
<div class="element"><label>Class Selection:</label><input name="Class" type="text" /></div>
<div class="element"><label>Preferred Meeting Time:</label><input name="Time" type="text" /> </div>
</form>
#registerwrapper .element {
margin-bottom: 15px;
vertical-align: middle;
}
#registrationwrapper label * {
float: left;
font-size: 16px;
}
#registrationwrapper input {
padding: 5px;
margin-left: 10px;
}