Home Previous TOC Next Bookshelf

2. HEAD and BODY Elements

From a start tag to its end tag is defined as an "element" in an HTML document. For instance, the HTML element starts from <html> to </html>. Since an HTML document (without document type declaration) starts from <html> and ends with </html>, the HTML element actually constitutes the entire document.

An element may contain other elements. The HTML element is composed of HEAD and BODY elements. The HEAD element contains information about the document, but not the document's actual content, which is given in the BODY element.

The HEAD Element

The most essential element within the HEAD element is the TITLE element. This element specifies the document's title, which is commonly displayed in the title bar of the window. The HEAD element may contain only one TITLE element, but it may include any number of the following elements:

  • STYLE controls the document's formatting via a language known as Cascading Style Sheet (CSS).
  • LINK links the current document to external files, such as the CSS files (with .css extension).
  • SCRIPT adds Javascript to make the document dynamic.
  • META provides additional information about the document.

Further details about STYLE and LINK are given in Chapter 9.

The BODY Element

There are many elements that can be included within the BODY element. The most common one is the P element, which is rendered as a paragraph. As you have seen in Chapter 1, the tags in the P element, <p> and </p>, can split text into paragraphs. Other elements are described in subsequent chapters.