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

Re: Too much info on auto-closing META tags - confusing

From: David Dorward <david@dorward.me.uk>
Date: Mon, 18 Oct 2004 16:32:54 +0100
To: Pim Blokland <pblokland@planet.nl>
Cc: www-validator@w3.org
Message-ID: <20041018153254.GA12455@us-lot.org>

On Mon, Oct 18, 2004 at 02:10:31PM +0200, Pim Blokland wrote:
> I've read all about it, and now I'm even less sure than before.
> My question is: are auto-closing META tags like this
> 
> <meta name="x" content="x" />
> 
> valid HTML 4.01 strict (even if the W3 validator says they aren't)?

The short answers are that "It is wrong to use XHTML style
self-closing tags in HTML" and that "The Validator is correct".

The long answer is that it may or may not be *valid* depending on
where you use it.

In HTML <foo /> (effectively) means the same as <foo>&gt;. 

Character data (i.e. &gt; or 'Hello, world') is not allowed within the
<head>.

However, the end tag for head and the start tag for body are optional.

So this is valid:

<title>Foo</title>
<meta name="x" content="x" />
<h1>Wibble</h1>

as it means the same as

<head>
<title>Foo</title>
<meta name="x" content="x">
</head><body>
&gt;
<h1>Wibble</h1>

The only browser I know that might respect this is Emacs w3-mode, so
its very badly supported and something you probably wouldn't want to
do anyway.

-- 
David Dorward                                      http://dorward.me.uk
Received on Monday, 18 October 2004 15:32:57 GMT

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