How can I get the second label and input to be on the same line as the first, while preserving the first label’s width, and the top padding?
Code below or here’s the jsfiddle version http://jsfiddle.net/kpBNB/2
<div>
<li id="input1">
<label>From</label>
<select>
<option value="1">1 am</option>
</select>
</li>
<li id="input2">
<label> until</label>
<select>
<option value="1">1 am</option>
</select>
</li>
</div>
div {
width: 100%;
background-color: #ccc;
}
li {
padding-top: 6px;
}
label {
width: 15%;
float: left;
display: block;
text-align: right;
}
To get the width on the
labelyou have to add a width to theli(as width is determined by the parent element). So something like this (see fiddle):