The Document Header

The 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 is never actually rendered as content visible to the user.

The <head> Tag

The <head> tag serves to encapsulate other header tags. Place it at the beginning of your document, just after the <html> tag and before the <body> or <frameset> tag. Both the <head> tag and its corresponding ending </head> tag can be unambiguously inferred by the browser and so can be safely omitted from an HTML, but not an XHTML, document. We encourage you to include them in all your documents, since they promote readability and support 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>, <isindex>, <link>, <meta>, <nextid>, <object>, <script>, <style>, and <title>.

The dir and lang attributes

As we discussed in the sections about the <html> tag attributes, dir and lang help extend HTML and XHTML to an international audience. [Section 3.6.1.1] [Section 3.6.1.2]

The profile attribute

Often, the header of a document contains a number of <meta> tags used to convey additional information about the document to the browser. ...

Get HTML & XHTML: The Definitive Guide, 5th Edition 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.