Thursday, 21 April 2011

Align radio button with corresponding label

You might have spent time to align the label against radio button or checkbox when you use RadioButton, RadioButtoList, CheckBox, CheckBoxList in ASP.NET. It can be fixed by using CSS vertical-align propery.

Example :

label, input[type="radio"]{
vertical-align:middle;
}

Or if you want to apply it for all the input fields

input, label{
vertical-align:middle;
}

This works for IE8, Firefox3.6 and Chrome as well. I may not work for IE6. Worth testing if your are targeting your site for IE6 users.

No comments:

Post a Comment