Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

margin-top: 0px; valid syntax for body {} ?

Status
Not open for further replies.

youradds

Programmer
Jun 27, 2001
817
GB
Hi,

Got a bit of a weird one here :/


In my body class, I have:

Code:
body {
  margin-top: 0px;
  margin-left: 0px;
  margin-right: 0px;
}

Now, this seems ok in IE 7, but not in Chrome or FF :/

Basically, it doesn't seem to be liking the margin-top: 0px bit. Anyone got any ideas?

TIA!

Andy
 
Yes - it's not just the body element you need to reset. Try this:

Code:
html, body {
   margin: 0px;
   padding: 0px;
}

And then if you want to set any margins, you would add those in as extras:

Code:
html, body {
   margin: 0px;
   padding: 0px;
}

body {
   margin-bottom: 50px;
}

Hope this helps,
Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Hi,

Thanks for the reply. In the end, it turned out to be that I needed to remove:

float: top;

(as thats invalid =))

..and then add:

margin-top: 0; padding-top: 0;

..to the "ul" section, as that was what was causing it to not show right =)

Thanks for the reply though - much appreciated :)

Cheers

Andy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top