Peggy Coats wrote:

>When I'm validating my CSS, I keep getting warnings such as listed below
>using the W3C validation service:
>
>   - Line : 5 (Level : 1) You have no color with your background-color :
>   body
>   - Line : 11 (Level : 1) You have no color with your background-color :
>   #content
>   - Line : 29 (Level : 1) You have no background-color with your color :
>   h2
>   - Line : 36 (Level : 1) You have no background-color with your color :
>   #text
>   - Line : 55 (Level : 1) You have no background-color with your color :
>   #nav
>
>In each of these instances I DO have the color attritubes identified with a
>hex code, and the respective element validates later in the results.  I'm
>confused!  Am I missing something here?
>  
>
Hi Peggy,
I think I know what is happening. The css-validator loves to see pairs 
of colors and background colors. So if you give a background color in 
the body (line 5), and the text color in a #text container (line 36), it 
is giving 2 warnings. For the body that the text on body level has no 
color defined, for the #text that the background on #text level has no 
background color! The ratio of this is in short: be aware that the 
contrast between the letter colors and the background is enough for 
accessibility at each level. It can happen when you have no good pairs, 
that changing the color of a background can make the text invisible in a 
page (or dynamically changed containers) far away from the stylesheet. 
Also personal browser preferences of a visitor can make things invisible 
or hard to read, if txt and bg are not in pairs.
But the validator warnings are not completely waterproof:

    * There can be a warning while the contrast is ok. - Probably in
      your case. You can give each bg-color a concrete txt-color (and
      v.v.), the easy way I often do it, is to add {color: inherit;} or
      {background: inherit;} > I'm quick finished, the validator is happy.
    * There can be no warning, while the contrast is very bad. - For
      instance a dark grey letter on a black background. And even when
      there is only 1 of 256 point difference on the hue scale, the
      validator sees "aha, different, no warning needed". As I am not an
      eagle, in this case I can see only a background without any text...

So an optical check is always needed too (try on different monitors, the 
differences can be enornous!).

Illustration: greyscale with contrast values 
<http://home.tiscali.nl/developerscorner/css-discuss/images/greyscale.gif>.

Greetings,
francky


______________________________________________________________________
css-discuss [EMAIL PROTECTED]
http://www.css-discuss.org/mailman/listinfo/css-d
IE7b2 testing hub -- http://css-discuss.incutio.com/?page=IE7
List wiki/FAQ -- http://css-discuss.incutio.com/
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/

Reply via email to