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

RE: margin vs. padding

From: Ian Hickson <ian@hixie.ch>
Date: Wed, 17 Jan 2001 20:06:06 -0800 (Pacific Standard Time)
To: "Charles F. Munat" <chas@munat.com>
cc: "'fantasai'" <fantasai@escape.com>, <www-style@w3.org>
Message-ID: <Pine.WNT.4.31.0101172003570.908-100000@HIXIE.netscape.com>
On Wed, 17 Jan 2001, Charles F. Munat wrote:
>
> 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?

Actually, this is not quite true, because of an often forgotten rule
of CSS2 in section 12.4:

# User agents should observe the following precedence rules to fill in
# the background: if the value of the 'background' property for the
# HTML element is different from 'transparent' then use it, else use
# the value of the 'background' property for the BODY element.

However, if you say

   html { background-color: white; }

...then your point should be proved (at least in the more compliant
browsers, like Netscape 6).

HTH,
-- 
Ian Hickson                                     )\     _. - ._.)       fL
Netscape, Standards Compliance QA              /. `- '  (  `--'
+1 650 937 6593                                `- , ) -  > ) \
irc.mozilla.org:Hixie _________________________  (.' \) (.' -' __________
Received on Wednesday, 17 January 2001 23:06:25 GMT

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