W3C home > Mailing lists > Public > www-validator@w3.org > November 2010

Re: W3C validator error - End tag for element "HEAD" which is not open

From: Jukka K. Korpela <jkorpela@cs.tut.fi>
Date: Mon, 8 Nov 2010 10:55:04 +0200
Message-ID: <C94CDF0785B7450F908C2117B46AB32E@JukanPC>
To: "John Collins" <john_collins70@rocketmail.com>, <www-validator@w3.org>
John Collins wrote:

> I’m the webmaster of http://www.canadabanks.net and after running my
> site through the W3C markup validator.I got 7 errors.

Most of the errors are caused by mixing HTML and XHTML. The page declares an 
HTML 4.01 doctype, yet uses the special XHTML feature of ending an empty 
element like a meta element with “/>” and not just “/”.

If you change the doctype declaration at the start to

<!DOCTYPE html
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

then most errors disappear. The remaining one is caused by a span element 
containing an h1 element, which is disallowed in all HTML versions. The 
obvious fix is to change the span element to a div element, though you need 
to check what impact this might have to styling (probably none, but worth 

> I understand most of the errors
> and I’ll fix them however this one really bothers me:
> Line 7, Column 489: end tag for element "HEAD" which is not open

This is a long and confusing story.
A brief summary:
When you use the “/>” notation, then by the formal rules of good old 
(non-XHTML) HTML, the “/” terminates the tag (such as link or meta tag), 
leaving the “>” as a data character. Now, the validator treats that data 
character as the start of document body, following the formal rules. The 
head element is implicitly closed, making the later </head> tag homeless.
The long story:
“Empty elements in SGML, HTML, XML, and XHTML”,

Yucca, http://www.cs.tut.fi/~jkorpela/ 
Received on Monday, 8 November 2010 08:55:44 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 22:59:19 UTC