This is one of the minor CSS problems that plagues me constantly. How do folks around Stack Overflow vertically align checkboxes
and
I have not completely tested my solution, but it seems to work great.
My HTML is simply:
I then set all checkboxes to 24px
for both height and width. To make the text aligned I make the label's line-height
also 24px
and assign vertical-align: top;
like so:
EDIT: After IE testing I added vertical-align: bottom;
to the input and changed the label's CSS. You may find you need a conditional IE css case to sort out padding - but the text and box are inline.
input[type="checkbox"] {
width: 24px;
height: 24px;
vertical-align: bottom;
}
label.checkbox {
vertical-align: top;
line-height: 24px;
margin: 2px 0;
display: block;
height: 24px;
}
If anyone finds that this doesn't work, please kindly let me know. Here is it in action (in Chrome and IE - apologies as screenshots were taken on retina and using parallels for IE):