Certified HTML5 Developer Learning Resources head element

Learning Resources
 

head element


The Head Element and Related Elements

HEAD

The HEAD element has no attributes and the start and end tag can always be safely omitted as they can be readily inferred by the parser. Information in the HEAD element corresponds to the top part of a memo or mail message. It describes properties of the document such as the title, the document toolbar, and additional meta-information. There is no intended significance to the order of elements in the document head. Note that the TITLE element is always required. In fact, the minimal HTML 3.0 document consists of the TITLE element alone!

Within the HEAD element, only certain elements are allowed. Information in the HEAD element may include the following elements (arranged alphabetically):


BASE

The BASE element allows the URL of the document itself to be recorded in situations in which the document may be read out of context. URLs within the document may be in a "partial" form relative to this base address. The default base address is the URL used to retrieve the document.

For example:

    
    ... 
    

which resolves to "https://acme.com/docs/images/me.gif".


ISINDEX

The ISINDEX element informs the HTML user agent that the document is an index document. As well as reading it, the reader may use a keyword search.

The document can be queried with a keyword search by adding a question mark to the end of the document address, followed by a list of keywords separated by plus signs. See the network address format for more information.

Note: A server normally generates the ISINDEX tag automatically. If added by hand to an HTML document, the browser assumes that the server can handle a search on the document. Obviously the server must have this capability for it to work: simply adding in the document is not enough to make searches happen if the server does not have a search engine!

Example:

    

The URL used for processing queries can be overridden with the HREF attribute. You can also use the PROMPT attribute to change the default prompt supplied by the browser, e.g.

    

LINK

The LINK element indicates a relationship between the document and some other object. A document may have any number of LINK elements. The LINK element is empty (does not have a closing tag), but takes the same attributes as the anchor element. The important attributes are:

REL
This defines the relationship defined by the link.
REV
This defines a reverse relationship. A link from document A to document B with REV=relation expresses the same relationship as a link from B to A with REL=relation. REV=made is sometimes used to identify the document author, either the author's email address with a mailto URI, or a link to the author's home page.
HREF
This names an object using the URI notation.

Using LINK to define document specific toolbars

An important use of the LINK element is to define a toolbar of navigation buttons or an equivalent mechanism such as menu items.

LINK relationship values reserved for toolbars are:

REL=Home
The link references a home page or the top of some hierarchy.
REL=ToC
The link references a document serving as a table of contents.
REL=Index
The link references a document providing an index for the current document.
REL=Glossary
The link references a document providing a glossary of terms that pertain to the current document.
REL=Copyright
The link references a copyright statement for the current document.
REL=Up
When the document forms part of a hierarchy, this link references the immediate parent of the current document.
REL=Next
The link references the next document to visit in a guided tour.
REL=Previous
The link references the previous document in a guided tour.
REL=Help
The link references a document offering help, e.g. describing the wider context and offering further links to relevant documents. This is aimed at reorienting users who have lost their way.
REL=Bookmark
Bookmarks are used to provide direct links to key entry points into an extended document. The TITLE attribute may be used to label the bookmark. Several bookmarks may be defined in each document, and provide a means for orienting users in extended documents.

An example of toolbar LINK elements:

    
    
    

The LINK element can be used with REL=Banner to reference another document to be used as banner for this document. This is typically used for corporate logos, navigation aids, and other information which shouldn't be scrolled with the rest of the document. For example:

    

The use of a LINK element in this way, allows a banner to be shared between several documents, with the benefit of being able to separately cache the banner. Rather than using a linked banner, you can also include the banner in the document itself, using the BANNER element.

Link to an associated Style Sheet

The LINK element can be used with REL=StyleSheet to reference a style sheet to be used to control the way the current document is rendered. For example:

    

Other uses of the LINK element

Additional relationship names have been proposed, but do not form part of this specification. Servers may also allow links to be added by those who do not have the right to alter the body of a document.


META

The META element is used within the HEAD element to embed document meta-information not defined by other HTML elements. Such information can be extracted by servers/clients for use in identifying, indexing and cataloging specialized document meta-information.

Although it is generally preferable to used named elements that have well defined semantics for each type of meta-information, such as title, this element is provided for situations where strict SGML parsing is necessary and the local DTD is not extensible.

In addition, HTTP servers can read the contents of the document head to generate response headers corresponding to any elements defining a value for the attribute HTTP-EQUIV. This provides document authors with a mechanism (not necessarily the preferred one) for identifying information that should be included in the response headers of an HTTP request.

The META element has three attributes:

NAME
Used to name a property such as author, publication date etc. If absent, the name can be assumed to be the same as the value of HTTP-EQUIV.
CONTENT
Used to supply a value for a named property.
HTTP-EQUIV
This attribute binds the element to an HTTP response header. If the semantics of the HTTP response header named by this attribute is known, then the contents can be processed based on a well defined syntactic mapping, whether or not the DTD includes anything about it. HTTP header names are not case sensitive. If absent, the NAME attribute should be used to identify this meta-information and it should not be used within an HTPP response header.

Examples:

If the document contains:




The server will include the following response headers:

Expires: Tue, 04 Dec 1993 21:29:02 GMT
Keywords: Nanotechnology, Biochemistry
Reply-to: [email protected] (Dave Raggett)

When the HTTP-EQUIV attribute is absent, the server should not generate an HTTP response header for this meta-information, e.g.

Do not use the META element to define information that should be associated with an existing HTML element.

Example of an inappropriate use of the META element:

Do not name an HTTP-EQUIV attribute the same as a response header that should typically only be generated by the HTTP server. Some inappropriate names are "Server", "Date", and "Last-Modified". Whether a name is inappropriate depends on the particular server implementation. It is recommended that servers ignore any META elements that specify HTTP equivalents (case insensitively) to their own reserved response headers.


NEXTID

The NEXTID is a parameter read and generated by text editing software to generate unique identifiers. This tag takes a single attribute which is the the next document-wide alpha-numeric identifier to be allocated of the form z123.

When modifying a document, existing anchor identifiers should not be reused, as these identifiers may be referenced by other documents. Human writers of HTML usually use mnemonic alphabetical identifiers.

Example:

    

HTML user agents may ignore the NEXTID element. Support for NEXTID does not impact HTML user agents in any way.

I want to get rid of NEXTID, or at least deprecate it!


RANGE

The RANGE element is used to mark a range of the document, for example for highlighting regions of the document matching some search criteria, or which are the subject of an annotation etc.

    

The FROM and UNTIL attributes specify positions in the document using SGML identifiers. Most elements in the document body can define such identifiers using ID attributes. The SPOT element is useful in this regard, as it allows search software etc. to insert IDs at random places:

     ... 

The RANGE element supports the following attributes:

ID
An SGML identifer used to name the range element.
CLASS
A character string used to subclass the range element.
FROM
References an SGML identifier for an element in the document body. It identifies the start of the marked range.
UNTIL
References an SGML identifier for an element in the document body. It identifies the end of the marked range.

STYLE

The STYLE element provides a means for including rendering information using a specified style notation. Information in the STYLE element overrides client defaults and that of linked style sheets. It allows authors to specify overrides, while for the most part using a generic style sheet, and as such improves the effectiveness of caching schemes for linked style sheets. There is one attribute - NOTATATION - which specifies an entity identifying an SGML notation in the HTML 3.0 DTD, for example:

    

Stylistic rules will in general match tag names and attribute values for elements in the document body. Context sensitive rules may be used for such purposes as rendering drop down capitals for the initial letter in the first paragraph following a header.


TITLE

Every HTML document must contain a TITLE element. The title should identify the contents of the document in a global context, and may be used in a history lists and as a label for the window displaying the document. Unlike headings, titles are not normally displayed in the text of a document itself.

The TITLE element must occur within the head of the document, and may not contain anchors, paragraph tags, or highlighting. There may only be one TITLE in any document.

The length of titles is unlimited, however, long titles may be truncated in some applications. To minimize this possibility, keep titles to fewer than 64 characters. Also keep in mind that a short title, such as Introduction, may be meaningless out of context. An example of a meaningful title might be:

    Recent Advances in Nanotechnology

 

 For Support