Re: Help for HTML Validator !

On Tue, 10 May 2005, ping wrote:

> http://www.power-depot.com/sitemap.htm
- -
> It's has a wrong for "there is no attribute "COLOR""

This formulation of the error message has been criticized, since it often
misleads people. You have
<hr color="#FF9900">
there, and yet the validator complains that there is no attribute "COLOR"!
What it means is that in the _document type definition_ there is no
such attribute for the element where you use it in the problematic case.

I guess 'attribute "COLOR" not declared for the element' or even
(if it were possible - I'm afraid it isn't without substantial software
rewrite) 'attribute "COLOR" not declared for the "HR" element'
would not be much better. Many people would intuitively (and wrongly)
assume that "declared" means "used".

My suggestion to the validator team is to change the pattern of error
messages to
'attribute "COLOR" not allowed here'
(which can be misunderstood too - as any communication can - since often
a document contains an attribute that is not allowed _anywhere_, but the
risk would be substantially smaller).

As regards to fixing the problem, this falls into the category described
in the error message explanation as
'This error is often caused - - by using vendor proprietary extensions
such as "marginheight" (this is usually fixed by using CSS to achieve the
desired effect instead).'
Here the 'color' attribute, as used in an 'hr' element, is a proprietary
extension, and you could replace it by the use of CSS as follows:

<hr style="color: #FF9900; background: #FF9900">

(The seemingly illogical use of both foreground and background color
is caused by browsers' different interpretations of the nature of the
'hr' element in CSS terms.)

Alternatively you could write just <hr> in the markup and

<style type="text/css">
hr { color: #FF9900; background: #FF9900; }
</style>

in the 'head' part, thereby making _all_ 'hr' elements on the page take
the desired color.

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

Received on Wednesday, 11 May 2005 03:41:28 UTC