I need an answer that utilizes only CSS, without any JavaScript. In a form, I have a checkbox as follows:
<label for="autologin">Remember Me</label>
<input type="checkbox" class="checkbox" id="autologin" name="autologin" value="1">
<div class="clear"></div>
Accompanied by the following CSS:
label {
float: left;
margin: 5px 0px;
}
input {
float: right;
margin: 5px 0px;
width: 200px;
}
.clear {
clear: both;
}
What additional CSS can be added to align the checkbox on the left within its 200px width? Floats seem challenging, particularly concerning vertical alignment, but are considered best practice.
EDIT: Many are suggesting avoiding floating inputs to the right. If that's the case, instead of using floats at all, could setting the width of the label and adding line breaks after each line be a better approach? Is this an acceptable practice or am I misusing floats?