Forum Moderators: open

Message Too Old, No Replies

cellpadding problems using a strict doctype

both IE and Firefox

         

tata668

3:16 pm on May 22, 2006 (gmt 0)

10+ Year Member



I'm trying to have an image in a table cell without any space/padding around the image.

If I use a HTML 4 strict doctype:

- If there is a newline before the ending </td> in my code, IE put some extra space after the image!

- Firefox put some padding in the cell, even with cellpadding="0". The only way I found to remove this padding is by adding "line-height:0px;" to the cell!

Can someone please tell me what is wrong or missing in my code? I'm pretty sure "line-height:0px;" is an ugly hack and not using newlines in my code is frustrating!

Here's my code:


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
</head>
<body>

<table cellspacing="0" cellpadding="0">
<tr>
<td style="background-color:Blue;line-height:0px;">
<img src="a.gif" /></td> <!-- IE: No newline here! -->
</tr>
<tr>
<td style="background-color:Lime;">
abcdefg
</td>
</tr>
</table>

</body>
</html>

tata668

3:48 pm on May 22, 2006 (gmt 0)

10+ Year Member



I just answered my own question:


img{display:block;}