Re: html, head and body tags optional -- but singly, or together?

On Tue, 5 Feb 2002, Perry, Russell wrote:

> It doesn't appear clear from the standard (looking at 4.01), but when you
> have start and end tag both optional, should they be optional as a pair, or
> each tag alone?  I ask because we discovered one of our pages had a <head>
> tag, but no </head> tag, and it validated okay, which surprised us.

Yes, no problem.  If you don't like it, you can run your HTML through
a normaliser (e.g. sgmlnorm), use a DTD tweaked to make these tags
mandatory, or use XHTML which always makes them mandatory.

> (http://www.w3.org/TR/html4/struct/global.html#edef-TITLE) says "Every HTML
> document must have a TITLE element in the HEAD section.", but if the head
> tag is entirely optional anyway, what do we do about title?  These things

The HEAD is not omitted when you parse the document.  It is implied.

To see this, take a valid page that omits one or more of these tags,
and validate it using the Visual Validator at
<URL:http://valet.webthing.com/page/>.
It will show you normalised source, including the omitted tags.

-- 
Nick Kew

Site Valet - the mark of Quality on the Web.
<URL:http://valet.webthing.com/>

Received on Wednesday, 6 February 2002 18:34:54 UTC