2.4. Head Tag Section

The head section of a document provides extra information about the document as well as serving as a container for sections such as styles and global scripts. A document's head section begins with the opening head tag (<head>) and ends with the closing head tag (</head>). Added to the other two elements previously discussed in this chapter, your HTML document should always resemble the following structure:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  <title>Title of Document Goes Here</title>
Body text of document goes here...

The <title> and <body> elements are discussed in the appropriately titled sections later in this chapter.

The following sections detail some of the various elements found in the head section.

2.4.1. Specifying the Document Title

The document title element supplies the title of the document to the user agent, who treats it appropriately: GUI-enabled agents usually display the title in their title bar, audible agents speak it aloud, and so on. As you would expect, the title appears in between opening and closing title tags (<title> and </title>).

For example, a document with the following title code would cause Mozilla's Firefox to display "A synopsis of last quarter's earnings" in its title bar:

<title>A synopsis of last quarter's earnings</title>

The document title is also routinely used as a label for the document when added ...

Get Web Standards Programmer's Reference: HTML, CSS, JavaScript®, Perl, Python®, and PHP now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.