- From: David Perrell <davidp@earthlink.net>
- Date: Mon, 6 Sep 1999 14:30:29 -0700
- To: "www-style" <www-style@w3.org>
Ian Hickson wrote: > The 'background' property cannot have the value 'transparent', since > it is a shorthand property. 'Background' can be used to declare a 'transparent' value for background-color, but it does not itself have that value, yes? A background declaration "first sets all the individual background properties to their initial values, then assigns explicit values given in the declaration."[1] So a background declaration that does not explicitly assign a background-color value assigns 'transparent' implicitly. > Furthermore, if the BODY background value is used when the HTML > element's 'background[-color]' value is transparent, then you get the > peculiar result that the following: > > HTML { background: url(logo.png) no-repeat top right; } > BODY { background: white url(paper.png) repeat; } > > ...would result in no logo. Yes, that's how I read [2] also. But I disagree with your solution because I believe the existing text is fundamentally wrong. The rules of the cascade are a basic foundation of CSS -- they cannot be arbitrarily ignored when convenient. In your example a value for background-color has been assigned to HTML; that value should be honored. It then follows that the background-color in any exposed areas of the canvas will be undefined (the default background-color of the UA), not the background-color of the next element in the document tree. I submit that the following revision of paragraphs three and four of [2] would be unequivocal and more in line with CSS cascading rules: ------------------" The background of the box generated by the root element extends to cover the entire canvas. For HTML documents we recommend that authors specify properties for the BODY element rather than the HTML element, as the HTML element is not generally considered to have display properties. User agents should observe the following precedence rules to apply background-color and background-image to the canvas: If any property is declared for the HTML element, extend the HTML background onto the canvas, otherwise extend the BODY background onto the canvas. If the resulting background-color is 'transparent' or 'inherited' then the background-color of the canvas is undefined. "------------------ Note that declaring *any* property for the HTML element declares HTML to be the root element. Also note that, regardless of the recommendation to apply properties to BODY, any author who wants to insure that their specified background extends to the edges of the viewport will either have to specify properties on HTML or set BODY margins to zero. BTW, the first paragraph of [2], which currently reads: "Authors may specify the background of an element (i.e., its rendering surface) as either a color or an image", should be changed to read: "Authors may specify the background of an element (i.e., its rendering surface) as a color and/or an image." Either/or is incorrect. David Perrell [1] <http://www.w3.org/TR/REC-CSS2/colors.html#background-properti es> [2] <http://www.w3.org/TR/REC-CSS2/colors.html#q2>
Received on Monday, 6 September 1999 17:32:36 UTC