W3C home > Mailing lists > Public > www-validator@w3.org > May 2004

Re: Head element reported not open, but it is

From: Kynn Bartlett <kynn@idyllmtn.com>
Date: Tue, 25 May 2004 02:57:03 -0700
Message-Id: <DF9B4829-AE31-11D8-B7F0-000393AF2932@idyllmtn.com>
Cc: www-validator@w3.org
To: Tomas Brunclik <tbrunclik@post.cz>


On May 25, 2004, at 12:48 AM, Tomas Brunclik wrote:

>
> In this validation result:
>
> http://validator.w3.org/check? 
> uri=http%3A%2F%2Fwww.levnapc.cz%2FCatalog.aspx%3Findex%3D1.2&charset=%2 
> 8detect+automatically%29&doctype=%28detect+automatically%29&ss=1&sp=1
>
> The message 2, which says:
> ****************
> Line 10, column 6: end tag for element "HEAD" which is not open
>
> </head>

Your problem is right here:

     <link href="sys_Styles.css" rel="stylesheet" />

Since this is HTML, you should NOT be using XHTML-style empty tags.
In XHTML, this means "a <link> that is self-closing."  In HTML, this
means "a <link> which doesn't have the right closing symbol for the
tag, but I'll ignore that, and then it's followed by a literal / and
a literal > -- wait, those can't appear as ordinary text in a <head>
element, so I guess we must have moved on to the <body>, so there's
an implicit </head> in there."

That's why it thinks your <head> element is already closed when it
gets to the real </head>.

In other words, it reads the line like this:

          <link href="sys_Styles.css" rel="stylesheet">
        </head>
        <body>
          /&gt;

Why does it do this?  Because that's what the HTML language (being
an SGML language) says is right.

The solution is that you need to stop using the <link /> kind of
tag in HTML.  It's not XHTML, so don't use XHTML in your code.

--Kynn

(Actually, I understand that the situation is a bit more complex than
  described above, but the explanation I gave explains it well enough
  for laymen to grasp what the problem is, and how to correct it.)


--
Kynn Bartlett <kynn@idyllmtn.com>                     http://kynn.com
Chief Technologist, Idyll Mountain                http://idyllmtn.com
Author, CSS in 24 Hours                       http://cssin24hours.com
Online Campaign Manager                   http://ByronForCongress.org
Inland Anti-Empire Web Log                http://inlandantiempire.org
AIM:  NextOfKynn  |  Cell:  (909) 202-9872  |  Office: (714) 526-5656
Received on Tuesday, 25 May 2004 05:57:11 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 25 April 2012 12:14:13 GMT