HTML: The Definitive Guide

Previous Chapter 3 Next
 

3.6 The Document Header

The HTML document header describes the various properties of the document, including its title, position within the Web, and relationship with other documents. Most of the data contained within the document header are never actually rendered as content visible to the user.

The <head> Tag

The <head> tag has no attributes and serves only to encapsulate the other header tags. Since it always occurs near the beginning of a document, just after the <html> tag and before the <body> or <frameset> tag, both the <head> tag and its corresponding ending </head> can be unambiguously inferred by the browser and so can be safely omitted from the document. Nonetheless, we do encourage you to include them in your documents, since it promotes readability and better supports document automation.

The <head> tag may contain a number of other tags that help define and manage the document's content. These include, in any order of appearance: <base>, <basefont>, <isindex>, <link>, <meta>, <nextid>, and <title>. For more information, see Chapter 6, Links and Webs.

The <title> Tag

The <title> tag does exactly what you might expect: the words you place inside its start and end tags define the title for your document. (We told you this stuff is pretty much self-explanatory and easier than you might think at first glance.) The title is used by the browser in some special manner, most often placed in the browser window's title bar or on a status line. Usually, too, the title becomes the default name for a link to the document if the document is added to a link collection or to a user's ``hot list.''

The <title> tag is the only thing required within the <head> tag. Since the <head> tag itself and even the <html> tag may be safely omitted, the <title> tag could be the first line within a valid HTML document. Beyond that, most browsers will even supply a generic title for documents lacking a <title> tag, such as the document's filename, so you don't even have to supply a title. That goes a bit too far even for our down-and-dirty tastes. No respectable author of an HTML document should serve up a document missing the <title> tag and a title.

Browsers do not specially format title text and ignore anything other than text inside the title start and end tags, such as images or links to other documents.

Here's an even barer barebones example of a valid HTML document to highlight the header and title tags:

<html>
<head>
<title>Using HTML: The Definitive Guide</title>
</head>
</html>

What's in a title?

Selecting the right title is crucial to defining a document and ensuring that it can be effectively used within the World Wide Web.

Keep in mind that users can access each of your documents in a collection in nearly any order and independently of one another. Each document's title should therefore define the document both within the context of your other documents as well as on its own merits.

Titles that include references to document sequencing are usually inappropriate. Simple titles, like ``Chapter 2'' or ``Part VI'' do little to help a user understand what the document might contain. More descriptive titles, such as ``Chapter 2: Advanced Square Dancing'' or ``Part VI: Churchill's Youth and Adulthood,'' convey both a sense of place within a larger set of documents and specific content that invites the reader to read on.

Self-referential titles also aren't very useful. A title like ``My Home Page'' is completely content-free, as are titles like ``Feedback Page'' or ``Popular Links.'' You want a title to convey a sense of content and purpose so that users can decide, based upon the title alone, whether to visit that page or not. ``The Kumquat Lover's Home Page'' is descriptive and likely to draw in lovers of the bitter fruit, as are ``Kumquat Lover's Feedback Page'' and ``Popular Links Frequented by Kumquat Lovers.''

People spend a great deal of time creating documents for the Web, often only to squander that effort with an uninviting, ineffective title. As special software that automatically collects links for users becomes more prevalent on the Web, the only descriptive phrase associated with your pages when they are inserted into some vast link database will be the title you choose for them. We can't emphasize this enough: take care to select descriptive, useful, context-independent titles for each of your HTML documents.

Related Header Tags

Other tags you may include within the <head> tag deal with specific aspects of document creation, management, linking, or automation. That's why we only mention them here, and describe them in greater detail in other, more appropriate sections and chapters of this book.

Briefly, the special header tags are:

<link> and <base>

Define the current document's base location and relationship to other documents. [<link>, 6.7.2] [<base>, 6.7.1]

<isindex>

Creates automatic document indexing forms, allowing users to search databases of information using the current document as a querying tool. [<isindex>, 6.6.1]

<nextid>

Makes creation of unique document labels easier when using document automation tools. [<nextid>, 6.8.2]

<meta>

Provides additional document data not supplied by any of the other <head> tags. [<meta>, 6.8.1]

<basefont>

Defines the default font size for a font model that some advanced browsers support, but that is not part of the HTML 2.0 standard. [<basefont>, 4.6.2]


Previous Home Next
HTML Document Elements Book Index The Document Body