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

Re: How is it possible to devise such a feeble system?

From: Andy <lordpixel@mac.com>
Date: Wed, 24 Oct 2001 15:26:45 -0400
Message-ID: <3BD715F4.673ABE56@mac.com>
To: www-style <www-style@w3.org>
Boris Zbarsky wrote:
> 
> > If that was the case, then if I was to apply a style to the body
> > element, and give it a background color, then I would only see the
> > background color on some of the page (for small documents), correct?
> 
> For XML (assuming you have a non-XHTML flavor of XML that has a <body>
> tag, yes.  For HTML as special case is made at
> http://www.w3.org/TR/REC-CSS2/colors.html#q2:
> 
>   For HTML documents, however, we recommend that authors specify the
>   background for the BODY element rather than the HTML element. 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. If the resulting
>   value is 'transparent', the rendering is undefined.
> 
> This is basically an ugly hack to handle the fact that in HTML
> background always got set on <body> and that people expect the behavior
> you describe....
> 
> > The body takes up the entire viewport (by default).
> 
> Try applying a border to <body> to see that this is not always the case.
> 


Indeed. I modified the body check example being used:

http://pixel.recoil.org/bodycheck.html

If you look at this in recent Mozilla you will see you can see different
<html> and <body> element colours if both are specified.
If you remove the html { } line from the style, the body colour is
applied to the whole viewport, which is what most ppl with expect by default.


(I also changed the DTD to an HTML strict mode one, don't know if that
was actually necessary)


-- 
AndyT (lordpixel)
Received on Wednesday, 24 October 2001 15:27:07 GMT

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