Comment on "FONT" error message

Hi,

while fixing up a document which used <font> to change colour inside a
<pre>, the validator gave this error message:

   document type does not allow element "FONT" here.

with a fairly lengthy description attached to the first occurrance of
this error:

   The element named above was found in a context where it is not
   allowed. This could mean that you have incorrectly nested elements
   -- such as a "style" element in the "body" section instead of
   inside "head" -- or two elements that overlap (which is not
   allowed).

   One common cause for this error is the use of XHTML syntax in HTML
   documents. Due to HTML's rules of implicitly closed elements, this
   error can create cascading effects. For instance, using XHTML's
   "self-closing" tags for "meta" and "link" in the "head" section of
   a HTML document may cause the parser to infer the end of the "head"
   section and the beginning of the "body" section (where "link" and
   "meta" are not allowed; hence the reported error).

However, me being a non-expert on HTML, I had trouble interpreting
what the mentioned "context" was, finding out why exactly this was a
problem, and what I could do about it to fix it, as the hint in the
second paragraph seemed to miss the mark by a wide margin.

I have since been told by our resident HTML expert that the context
was probably <pre>, and that it is much preferable to use CSS than to
use <font> to change colour.  The document was then fixed up, and now
validates with those changes.

It was then somewhat ironic that the "tip of the day" presented to
*after* successful validation would have been very helpful in the
above error message, namely:

   http://www.w3.org/QA/Tips/color

So... My suggestion is to perhaps specialize the above error message
and point towards that QA for errors of this type relating to <font>?

Best regards,

- Håvard

Received on Tuesday, 22 August 2006 09:41:38 UTC