2008-01-29

IE7 puts a margin around form elements but Firefox doesn't

I was going nuts trying to figure out why IE7 put some unwanted white space around a table but Firefox rendered it properly with no margin, despite explicitly setting margins for the table as 0 in CSS.

After a lot of trial and error, and fruitless Google searches, I figured out that it was the Form element that I had inside the table that was causing the problem. Apparently IE7 puts a margin around a Form element by default but Firefox doesn't. To get rid of the unwanted whitespace I just added the following to my CSS:

Form
{margin: 0px}

1 comment:

Anonymous said...

Thanks, that saved me time. Netscape and Safari rendered it correctly but IE7 had the margin, and I didn't even have any tables in the page.