Re: Weird CSS warning...

On Sat, 1 Oct 2005, Maurice Robert wrote:

> When I check my site with the CSS validator I get a really strange
> warning: Regel
> : 23 (Level : 1) U heeft geen kleur voor uw achtergrondkleur opgegeven :
> #autoXML14684481468448
> But there's no #autoXML14684481468448 in my site at all...
> My validation is:
> http://jigsaw.w3.org/css-validator/validator?uri=http://epsilon.uwhosting..net/~mauz/

(It seems that there is something very wrong with the multilingualism of 
the "CSS Validator". There are no explicit links to versions in other
languages, only language selection using content negotiation - which is 
guaranteed to fail horrendously often, since the preferences in people's 
browsers don't match their real preferences.)

Anyway, the English text for the warning is
"You have no color with your background-color"
and this new warning has been discussed to some length in the validator 
list, see the archives at 
http://lists.w3.org/Archives/Public/www-validator-css/

Presumably the odd reference to a nonexistent anchor means that the 
warning relates to an _embedded_ style sheet, i.e. to CSS code inside
a style="..." attribute, as in

<div class="content" style="position: absolute; width: 750px; height: 
100px; top: 10px; left: 10px; background: scroll no-repeat center center 
url(image.php?type=logo&amp;bgcolor=FFFFFF&amp;fontcolor=CCCCCC) 
#FFFFFF;"></div>

The warning itself is useful. By using the background shorthand, you are 
actually setting background-color to transparent. Since you don not set 
the color property for the element, you take the risk that your document 
will be displayed with the background specified in your code and with a 
content color specified somewhere else. And who knows what this implies? 
Maybe white on white. The risk is fairly small in practice, but it's 
unnecessary to take it.

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

Received on Sunday, 2 October 2005 13:04:55 UTC