Re: CSS validator complaining about no background-color when I clearly have one

> Au contraire, it knows more about it than most web page authors.
That is good, but not good if it does not explain how it arrived at the 
conclusion.
>> Make sure that cascading of colors keeps the text reasonably legible.
>
> The cascade is the most commonly misunderstood of all CSS concepts, so 
> that note is of questionable value.
Yes, the concept of which rule wins is always a bit dicey except when 
explicit (which is last one wins if explicit).

> It's a rule, not an element (there are no elements in CSS, just 
> notations that refer to elements). And it sets properties for the body 
> element.
Sorry, I meant rule. Slip of the fingers ;-)
>> The next level is a div with another background-color and inherits the
>> foreground.
>
> Automatic inheritance only takes place when no style sheet being 
> applied assigns a value for a property of an element.
Of course. We all agree that explicit rules trump implicit and the 
latter of explicit wins. But, I have no user override.
> Consider, for example, what happens when the browser applies, in 
> addition to your style sheet, the following user style sheet:
> * { background: black; color: white; }
> (which could be a useful part of a user style for a user suffering 
> from eyesight problem due to which white on black is much more legible 
> than black on white).
That is a matter of taste and settings of the screen. White on black 
often ends up with unreadable text because of contrast and brightness 
settings. When brightness is turned down, small white text goes gray).
But, I am OK with them doing this. The point is that the validator is 
not saying that. If it simple said that implicit background-color could 
be overridden, that would be fine.
> Just in case this isn't obvious enough: for your div#main, the 
> background property is taken from your style sheet, because it's an 
> author style sheet, but the color property is taken from the user 
> style sheet.
Right, but the complaint was over not having a background color. I 
clearly have a background-color. The fact that a later style sheet could 
override it is not the point - I have one. It could say you have not 
explicitly set one on every block level element and so you may get 
overridden by overzealous users, but that is different than saying I do 
not have one.
Are you saying that DIV does not inherit from BODY assuming no other 
explicit background-color for either? That would contradict my 
understanding of CSS and the DOM rules (CSS applies rules to DOM 
elements and DOM elements inherit rules from outer elements and then 
apply any explicit ones).

Thanks, Paul

-- 
Paul Kimelman                   Personal email
Home: 925.256.4048              Mobile: 510.882.6495

Received on Monday, 4 January 2010 01:39:33 UTC