Click to See Complete Forum and Search --> : td padding only working right in IE


BuilderQ
07-20-2005, 05:53 PM
On one of my sites (http://fourinarow.50webs.com), I'm trying to duplicate cellpadding="0" with css.

td {
background-color : #4682b4;
border-width : 1px;
border-style : inset;
padding : 0;
}

However, only in IE does this work as I want. Opera and Netscape distort what is meant to be grid of squares, by adding padding below the images in the cells. There must be a simple fix for this?

bogbrushian
07-20-2005, 05:57 PM
I aren't completely sure, but don't you need the units of the padding for it to work? ie. 0px rather than just 0?

BuilderQ
07-20-2005, 11:47 PM
I've changed it to 0px; no change. Any other ideas?

NogDog
07-21-2005, 12:19 AM
Try adding this to your CSS so that the img's inside of td's are treated as block-level elements:

td img {
display: block;
margin: 0;
padding: 0;
}

PS: when a dimension is zero (0), that's the only time you don't need a unit.

BuilderQ
07-21-2005, 10:12 AM
Ah, that's done it, thanks. :)