Re: use of colornames & validation

On Tue, 4 Sep 2007, NOWAR.MEANS.PEACE@GMAIL wrote:

> On the next w3schools page I got the following information about the 
> use of color-names

w3schools is not an authoritative source of information. Many people think 
that it is not reliable either (and often back this up by pointing out 
specific errors).

> QUOTE:
> Note: If you want your pages to validate with an HTML or a CSS validator, W3C has listed 16 color names that you can use:
> aqua, black, blue, fuchsia, gray, green, lime, maroon, navy, olive, purple, red, silver, teal, white, and yellow.
> If you want to use other colors, you must specify their RGB or HEX value.
> END OF QUOTE

That's misleading in more ways than I care to list down.

> So, how come that when a colorname that is NOT in the 16-list is used, the w3c html-validator still validates the page,
> instead of coming up with an error ??

This part is simple and basically the same as with href attribute values. 
The COLOR and BGCOLOR attributes in HTML are declared as CDATA attributes. 
You can write color="hello world!" or color=")-/%?/%", and it is _valid_ 
but not _correct_. That is, it is incorrect in a manner that is not 
described in the formal syntax that a validator operates on.

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

Received on Tuesday, 4 September 2007 13:20:15 UTC