contents introduction reference index previous next
HTML 4 - User's Guide
Document relationships and the LINK element
Contents:
1. SAMPLES
1.1 Identifying a style sheet
1.2 Multilanguage document
1.3 Cover page, contents, glossary, index
2. USAGE
2.1 Placement
2.2 Uses
2.2.1 Style sheet
2.2.2 Navigation purpose
2.2.3 Helping the search engines
3. SYNTAX
Attributes

The LINK element defines a link to another document. Such a link has a name. The HTML specification defines a number of names which have a special meaning. The user agents are expected to process these links according to their defined meaning. One of the widely used names is stylesheet which identifies links to a style sheet.

Information contained in the LINK elements can also be used by search engines to find documents with desired characteristics.

1. SAMPLES

1.1 Identifying a style sheet

<LINK rel="stylesheet" type="text/css" href="http://www.hatayservices.com/books/HatayBook.css"
In this, the attributes are:
- rel specifies the name of the link, here: 'stylesheet'
- type specifies the content type of the referenced document, here: text/css
- href specifies the URI of the target document of the link
This LINK element defines a style sheet.

1.2 Multilanguage document

<HEAD>
<LINK rel="alternate" hreflang="fr" href="http://books/doc-francais.html
type="text/html">
<LINK rel="alternate" hreflang="de" href="http://books/doc-deutsch.html
type="text/html">
<LINK rel="alternate" hreflang="it" href="http://books/doc-italiano.html
type="text/html">
</HEAD>
In these LINK elements
- The rel="alternate" attribute, with the alternate predefined keyword indicates a link to an alternate form of the current document
- The hreflang attribute specifies the language code of the alternate document
- The href attribute specifies the URI of the alternate document
- The type="text/html" attribute indicates that the document contains HMLT text
Such information can be used by a search engine to find the document in the desired language.

1.3 Cover page, contents, glossary, index

<HEAD>
<LINK rel="start" type="text/html" href="http://books/doc-cover.html">
<LINK rel="contents" type="text/html" href="http://books/doc-contents.html">
<LINK rel="glossary" type="text/html" href="http://books/doc-glossary.html">
<LINK rel="index" type="text/html" href="http://books/doc-index.html">
</HEAD>
The rel attributes, with the different predefined keywords
start
contents
glossary
index
indicates different types of document related to the current one - 'start' indicates the first document in a collection, which can stand for the cover page.

The other attributes have the same meaning as in the above.

2. USAGE

2.1 Placement

The <LINK> elements are placed in the contents of the HEAD element, in any number and order.

2.2 Uses

The LINK can be put many uses, by user agents or search engines. Some of these uses are:
- identifying an external style sheet file
- navigation among documents
- providing information to search engines

2.2.1 Style sheet

The LINK element identifying a style sheet has the following attributes:
href="uri"where the value of the href attribute is the URI of the external style sheet file.
rel="stylesheet"where "stylesheet" is a name defined in the HTML specification
type="text/css"where "text/css" indicates that the referenced document centents a style sheet

2.2.2 Navigation purpose

The HTML specifications suggests that user agents may provide means to navigate among documents by setting up a tool bar or a drop down menu based on predefined names assigned to the "rel" (forward relation) or "rev" (reverse relation) attributes. Such names are:
- next
- prev
- contents
- index
- etc.
To see the full list and meanings of these names, please click here.

2.2.3 Helping the search engines

Attributes of the LINK element can be used to provide information to help search engines find related documents.

Some of the possible uses are:

- identification of alternate versions of the document set in other languages.
- identification of the document cover page, contents, glossary or index

Other information to help search engines are provides by the <META> elements.

3. SYNTAX

Attributes

The LINK element has the common attributes and the following attributes:
hrefhref="uri#location"Specifies the target location
typetype="contentType"Content type of the targer document - this helps the user agent save on loading documents that it cannot process
charsetcharset="charset"Encoding method of the link source
hreflanghreflang="langCode"Code of the language of the target document
relrel="linkType"Forward link type of the target document
revrev="linkType"Reverse link type of the target document
targettarget="frameTarget"specifies the frame where the referenced document is to be displayed
mediamedia="media"specifies the medium on which the referenced document is to be displayed

contents introduction reference index previous next
back to top