HTML and CSS Reference
In-Depth Information
Some of the metadata elements we'll be covering in this chapter can't appear anywhere else in a
document except within the
head
element. That's one more good reason to include the element: it makes it
very clear where the header ends and your other content begins. You'll see a few more examples of the
head
element in this chapter as we detail the metadata elements it contains.
Required Attributes
The
head
element doesn't require any attributes.
Optional Attributes
The
head
element doesn't have any optional attributes.
Previous versions of HTML and XHTML had an optional
profile
attribute for the
head
element, and its value was one or more URLs pointing to additional metadata profile
definitions that extend the metadata already inherent in HTML. The
profile
attribute is
obsolete in HTML5, and metadata profiles can be extended by the
meta
and
link
elements instead (both covered in this chapter).
title
The
title
element provides a text title for the document. It appears as a child of the
head
element, and
there can be only one
title
per document. It's also a required element; every HTML document must have
exactly one
title
element.
Browsers display the contents of the
title
element in the browser window's title bar, and the page's tab
in browsers that offer tabbed browsing (like Safari does in Figure 3-1). The title also acts as the default
page name when a visitor bookmarks the page or saves it as a favorite, so it should describe the page
even when read out of context.
Figure 3-1.
Browsers display the contents of a
title
element in tabs and title bars