[thelist] html attributes for margin width etc

Mark Howells webdev at mountain.ch
Thu Oct 17 08:01:01 CDT 2002


>> body	{margin:-10px 0 0 -10px}
>> html body {margin:0}
>
> Now for Opera: it has the same margin problems, and the -10px hack
> works,
> but how do you evade the html body line, which Opera does understand?

All CSS browsers will set the negative margins and then, any browsers
which understand the second definition (i.e. not NN4) will then set the
margins back to 0, as they can interpret 0,0 as being 0,0 and not
10px,10px (as is the case in NN4). I believe that Opera is the
exception to the rule, as it uses padding and not margin to move the
body from the browser edge. Thus;

body {margin:-10px 0 0 -10px}
html body {margin:0;padding:0}

should cover most browsers in current use. There's a demonstration of
this principle at <http://www.mark.ac/help/noBorder.html>

Regards
Mark Howells
<http://www.mark.ac/>
AIM: mhoaim




More information about the thelist mailing list