Forum Moderators: not2easy

Message Too Old, No Replies

unwanted margin and padding to table in Firefox

Firefox not listening to margin and padding styles

         

ln_tora

4:55 am on Mar 25, 2006 (gmt 0)

10+ Year Member



Hello. Currently having a problem with Firefox, which is rare, but there it is.

I'm trying to display a table with no margin and no padding. It does as told in IE6 when I check with a border, but in Firefox 1.5, I'm getting an unwanted top margin, (a full line break from the looks of it), and unwanted bottom padding. I just can't figure out how to get rid of either one.

My code looks like this:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>untitle</title>
<style type="text/css">
<!--

/* basic body and anchor styles, snip.... */

table, tr, td { margin: 0px; padding: 0px; }
tr, td { border: none; }
table { border: 1px solid #00f; }
-->
</style>
</head>
<body>

<!-- mainly p tags, snip... -->

<table cellpadding="0" cellspacing="0">
<tr>
<td>{content here}</td>
</tr>
<tr>
<td>{content here}</td>
<tr>
</table>
</body>
</html>

Again, IE is listening, (for once), but not Firefox. I didn't think the rest of the code was needed for the example, since the table doesn't really interact with anything else on a styling level. I also checked in Netscape and Opera, and I get similiar results as Firefox, so I'm thinking I'm doing something wrong, and IE is just being too nice.

Any help on this is greatly appreciated.

JAB Creations

5:16 pm on Mar 25, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



This is what I do to get rid of any added space...

table, td, tr, thead, tfoot, tbody, th, tf {
border-collapse: collapse;
margin: 0px;
padding: 0px;

Get rid of cellspacing and cellpadding, they've been replaced with border-collaspe. I think there is actually a fourth CSS spec that is table specific but I'm not sure.

John