W3C home > Mailing lists > Public > www-style@w3.org > January 2001

RE: margin vs. padding

From: Charles F. Munat <chas@munat.com>
Date: Wed, 17 Jan 2001 19:56:15 -0800
To: "'fantasai'" <fantasai@escape.com>, <www-style@w3.org>
Message-ID: <000401c08102$9b9b2e50$0100a8c0@aries>

>> is there any preference for one of them on the Body tag in CSS ??

> I think padding makes more sense, but I don't know what's preferred.

That depends on whether you consider the "body" to encompass the entire
window. Currently, that is always the case, but what if a web page were
inserted into another page (say, an SVG page)? Then the margins might make
more sense.

Actually, both make sense even now, but you wouldn't know that from the way
body is implemented. What would make the most sense would be this:

body { background: red; margin: 10px; padding: 10px; }

Assuming the browsers default background color is white, there should be a
10px white band around the page. The body content would then sit 10px
further inside the red area. Make sense?

I tested this in Opera, IE, and Netscape and none of them showed a white
border. Evidently, body is identified with the window itself. I don't see
any reason it must be...

Charles F. Munat,
Seattle, Washington
Received on Wednesday, 17 January 2001 22:49:22 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:54:07 GMT