Learning HTML 3.2 by Examples, section 4 Fundamental structures in HTML 3.2, with examples:

The obligatory structure of a document

First of all, let us start with an extremely primitive HTML document: one that only contains the words Hello world as plain text. In an HTML file, the contents must be preceded by a head section which minimally consists of two constructs. Our HTML code would be as follows:

Example hello.html:

Hello world
In fact, this document implicitly has the following structure, i.e. it is equivalent to the following:

Example hello2.html:

Hello world
This means that apart from the first line, the entire file is an HTML element which contains a HEAD element, with the TITLE element as contents, and a BODY element, with the plain text as contents.

Thus, in the absence of HTML, HEAD, and TITLE tags a browser implicitly assumes them in suitable places. Therefore, your document always contains a head and a body.

(In fact, the example above does not conform to the requirements of HTML 4.0 Strict: the text Hello world should be enclosed into a P element, for example. See notes in the description of the BODY element.)

Date of last update: 2010-12-16.
This page belongs to the free information site IT and communication, section Web authoring and surfing, by Jukka "Yucca" Korpela.