Re: Option HEAD element

Joe English (jenglish@crl.com)
Fri, 08 Sep 1995 12:36:10 -0700


Gayle Kidder <reddik@thegroup.net> wrote:

> A point of confusion in the HTML 3.0 draft:
> The draft allows for the omission of the HEAD element.

The HEAD *element* is always required:

<!ENTITY % html.content "HEAD, BODY">
<!ELEMENT HTML O O (%html.content)>

it's the <HEAD> and </HEAD> *tags* that are omissible:

<!ENTITY % head.content "TITLE & ISINDEX? & BASE? & STYLE?
& META* & LINK* & RANGE*">
<!ELEMENT HEAD O O (%head.content)>

In particular, every HTML document must have a TITLE,
and TITLE appears in the HEAD, so the HEAD element is
always present (even if the start- and end-tags are not).

> Is this
> simplification only for those who do not wish to use one of the other HEAD
> tags such as META, BASE, ISINDEX... If you do use one of these tags, is HEAD
> then required?

<HEAD> and </HEAD> are omissible in HTML 2.0 for backwards-compatibility
with older documents that were written before <HEAD> was introduced;
I expect that they're omissible in HTML 3 for the same reason.

Strictly speaking, <HEAD> and </HEAD> are *never* required,
since an SGML parser can always tell when the HEAD element ends
and the BODY element begins. However, it's considered good
practice to include the start- and end-tags anyway (mostly to
make life easier for HTML processing tools that don't include a
true SGML parser, i.e., most browsers :-)

One rule of thumb is, as you mention, that <HEAD> and </HEAD>
could be left out if the document does not contain any HEAD elements
other than TITLE.

A better rule of thumb is to always use <HEAD> and </HEAD>.

--Joe English

jenglish@crl.com