2010-05-07 35 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