Forum Moderators: not2easy
<style type="text/css">
body {
margin: 0px;
}
</style>
This is, however, not the correct way to do it. You are supposed to use padding, not margin, since the margin property suggests a an outer margin between the BODY and HEAD sections.
Padding is always an inner margin, from the edge of the element to the contents.
The correct way to specify margins for the body would therefore be:
<style type="text/css">
body {
padding: 0px;
}
</style>
Try something like
HTML { padding: 3em; background: green; }
BODY { background: white; }
and you'll see a nice green canvas with the BODY placed on top of it.
The NYPL style sheets use BOTH margin and padding: body{margin:0; padding:0;}... probably a pretty safe bet all the way around (no pun intended!).
The "habit" of declaring margins is a carry-over from the bad-old-days of <body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"> needed to appease both propriety IE & NN.
There's a "collapsing rule" that comes into play when all four values aren't declared. The order for the four values is:
TOP -- RIGHT -- BOTTOM -- LEFT
If the value for Right is missing, the value for Top is applied
If the value for Bottom is missing, the value for Top is applied
If the value for Left is missing, the value for Right is used
So, a three value declaration (v1 v2 v3) gives v1 -- v2 -- v3 -- v2
A two value declaration (v1 v2) gives v1 -- v2 -- v1 -- v2
And a one value declaration uses that value for all four positions