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" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html> <head> <title>Title of Document Goes Here</title> </head> <body> Body text of document goes here... </body> </html>
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 the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.