2010-05-07 37 views
3

我收到一吨像当我做了CSS验证检查下面列出的警告的颜色和背景颜色通过http://jigsaw.w3.org/css-validator/validator?uri=http%3A%2F%2Fwww.gamefriction.com%2FCoded&profile=css21&usermedium=all&warning=1&lang=enCSS验证警告:相同的颜色,两种环境下

> 513  Same colors for color and 
> background-color in two contexts 
> #blue_module and #red_module_top 513  Same colors for color and 
> background-color in two contexts 
> .content ul li and #red_module_top 513 
>  Same colors for color and 
> background-color in two contexts 
> #footer_container and #red_module_top 513   Same colors for color and 
> background-color in two contexts 
> ul.tabs li a.active and 
> #red_module_top 513  Same colors for color and background-color in two 
> contexts #content_960 and 
> #red_module_top 513  Same colors for color and background-color in two 
> contexts #content_main and 
> #red_module_top 513  Same colors for color and background-color in two 
> contexts .content and #red_module_top 
> 513  Same colors for color and 
> background-color in two contexts 
> #league_module select option and #red_module_top 513  Same colors for color and background-color in two 
> contexts #red_module and 
> #red_module_top 

任何想法如何解决这个问题?

CSS文件:gamefriction.com/Coded/css/style.css

回答

2

它的意思是你在一些背景中有相同的背景色和前景色。从你的CSS示例(一些声明为清楚起见省略):

#red_module_top { 
    background: url(http://www.gamefriction.com/Coded/images/red_content_top.jpg) no-repeat; 
    color: #fff; 
} 

通知您如何设置color: #fff。这意味着你的前景色是白色的。但是你的背景颜色没有设置。您可以设置背景图像,但如果由于某种原因图像不可用,则背景也将变为白色(因为您的身体标记未定义背景颜色,验证程序认为它是白色的),从而使文本不可见。

您只需在背景线上添加颜色即可解决此问题。例如:

background: #ff0000 url(http://www.gamefriction.com/Coded/images/red_content_top.jpg) no-repeat; 

现在会发生什么情况是验证器会看到背景与前景不同并且没有抱怨。

+0

cool!谢谢!这让我感到困惑 – Meta 2010-05-07 19:15:16

0

它的抱怨可访问性的原因,颜色将使其难以阅读的文本。如果文本颜色和背景颜色相同,则根本无法读取它。

+0

嗯,问题是没有文字显示在网站上,它是背后的背景相同的颜色。我对CSS非常陌生,并且使用DIV而不是表格(几天前从各种css tutus自学成教并查看其他站点的源代码)。 – Meta 2010-05-07 18:40:24