RE: margin vs. padding

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 UTC