RE: CSS Validation warning: You have no background-color with your color;

On Tue, 21 Feb 2006, Peter Normann wrote:

> However, IMHO the presence of a transparent parameter implies that the risk
> of not specifying a color has been considered. Otherwise the background
> property would not have been set in the first place.

I'm afraid the documentation at
http://jigsaw.w3.org/css-validator/
is not maximally usable, since the most obvious place to look for info on 
problems is the "Docs" section, which is however quite technical.
I hope a link to the FAQ can be added there. It's not very intuitive
that you need to visit the "Feedback" section to find a FAQ.

Anyway, the FAQ entry
http://www.websitedev.de/css/validator-faq#color
explains the issue, though rather compactly:
"If you don't specify color and  background-color at the same level of 
specifity, your style sheet might clash with user style sheets."
Besides, it's not the whole truth. If you set background: transparent
for an element X contained in an element Y, expecting the background of Y 
to shine through, the assumption may fail because a user style sheet (or a 
browser style sheet, or another author style that will be combined with 
yours) sets background for Y. For all that you can know, the background 
color could be the same as or similar to the content color you set for X.
(Specificity is just one of the factors that affect the question which
CSS rule will be applied to an element if there is a conflict.)

-- 
Jukka "Yucca" Korpela, http://www.cs.tut.fi/~jkorpela/

Received on Tuesday, 21 February 2006 12:07:08 UTC