W3C home > Mailing lists > Public > www-validator-css@w3.org > February 2006

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

From: Peter Normann <peter@normann.com>
Date: Tue, 21 Feb 2006 17:10:03 +0100
To: <www-validator-css@w3.org>
Message-ID: <058d01c63701$4823f990$062b96d5@normann.com>

Jukka K. Korpela wrote:
> 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. 

I did actually find the FAQ before posting the question on the list.
> 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." 

... I am not sure that I agree that the color has not been specified,
although I concur that tranparency indeed is not a color. Consider this

      td { background-color: #00ff00; color: black; }
      td.level1 { background-color: #ff00ff; color: black; }
      td.level2 { color: black; } <-- No background color
      table { width: 100%; }
    <table width="100%">
       <td class="level1">
              <td class="level2">&nbsp;</td>

Notice td.level2 has no background-color set. The background-color will be
that of the generic td element - green in this case. However, if you add
td.level2 { background-color: transparent; } it will render magenta, i.e.
the background-color of td.level1. Thus I have made a conscious choice as to
which background-color the td.level2 should render.

> 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.)  

Well, usually the most comprehensive and perfected plan will have things run
smoothly - until you meet the enemy...
Received on Tuesday, 21 February 2006 16:10:12 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:40:41 UTC