Friday, June 26, 2009

checkbox margins in IE incorrect

Problem:
By default, checkboxes have some margin and perhaps padding so they take up a bit more space than is needed. I needed to make some checkboxes take up the least amount of space possible, and the following css:

input {
margin:0;
padding:0;
}


didnt work in IE6 and IE7, while working perfectly in firefox (as usual).

Solution:

Add the following IE only css:

<!--[if IE]>
<style type="text/css">
input {
margin: -5px;
}
</style>
<![endif]-->


This fixes the problem on IE6, and IE7, i dont know if IE8 has this problem or not.

No comments:

Post a Comment