Can the padding/margin on radio buttons in IE6/IE7 be reduced to 0-1px

internet explorerinternet-explorer-7padding

In Firefox and IE8 this isn't a problem, but in IE6, and IE7 I can't seem to reduce the padding/margin on radio buttons to anything reasonable (e.g. 0px or 1px).

In the included images, you can see that the red background is huge on IE6/IE7 (even with CSS padding and margin both set to 0px) yet in Firefox/IE8 it is fine.

The reason of course is that the tree I'm rendering looks horrible with the gaps in IE6/IE7.

IE6/IE7

alt text http://img190.imageshack.us/img190/9985/ie7l.png

Firefox/IE8

alt text http://img23.imageshack.us/img23/3411/ie8k.png

Notes: the page runs in standards mode, and the red is just for illustration.

Some sample code (for those that want to hack at it)

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>IE Radio button padding hell</title>
<style>
  input{
    background-color:red;
    border:0px;
    margin:0px;
    padding:0px;
  }
</style>
</head>
<body>
  <form name="asdf">
    <input type="radio" name="sdfgsd" value=""/>asdf<br/>
    <input type="radio" name="sdfgsd" value=""/>asdf<br/>
    <input type="radio" name="sdfgsd" value=""/>asdf<br/>
    <input type="radio" name="sdfgsd" value=""/>asdf<br/>
  </form>
</body>
</html>

Best Answer

Use height to solve this problem.

I am using this on class on input:

.radiobtn
{
border:0px;
height:14px;
}

on:

<input type="radio" class="radiobtn" name="radio"  value=""/> Yes

It will work fine in I.E 6.0/7.

Related Topic