marginheight & marginwidth

liunx

Guest
To make my site design acceptable in Netscape and Opera, I have to use the marginheight and marginwidth attribute in the BODY tag. However this does not conform to the XHTML standards. How do I prevent this? Style sheets aren't much of a help either.<!--content-->Both of those are depreciated, use this instead:body{<br />
margin:0;<br />
padding:0;<br />
}<!--content-->0px<!--content-->You only need units for non-zero lengths because 0%, 0px, 0ex, 0cm, 0mm, 0in, 0em & 0pt all mean the same thing.<br />
<br />
Edit: I thought I should clear up any confusion with the padding and margins for the body tag just in case you don't want non-zero values for them.<br />
<br />
The margin:0; is to eliminate IE's default values for the margin, and the padding:0; is to eliminate the standards compliant browsers default padding.<br />
<br />
If you want to set your own padding for the body tag, then do this:body{<br />
margin:0;<br />
padding-top:1px;<br />
padding-right:2em;<br />
padding-bototm:3%;<br />
padding-left:4in;<br />
}The above code could also be written:body{<br />
margin:0;<br />
padding:1px 2em 3% 4in;<br />
}If you do use the shortened version for padding then make sure that you get the order right, if you are unsure then it's probably best to write it out fully.<br />
The same order also applies to margin and border-width.<!--content-->Thanks for the help. It worked perfectly.<!--content-->Happy to help. :)<!--content-->
 
Back
Top