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"
- | 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
|
LINK
element defines a style sheet.
1.2 Multilanguage document
<HEAD>
<LINK rel="alternate" hreflang="fr" href="http://books/doc-francais.htmltype="text/html">
<LINK rel="alternate" hreflang="de" href="http://books/doc-deutsch.htmltype="text/html">
<LINK rel="alternate" hreflang="it" href="http://books/doc-italiano.htmltype="text/html">
</HEAD>
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 |
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>
rel
attributes, with the different predefined keywords
start
contents
glossary
index
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
TheLINK
can be put many uses, by user agents or search engines. Some of these uses are:2.2.1 Style sheet
TheLINK
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:2.2.3 Helping the search engines
Attributes of theLINK
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
TheLINK
element has the common attributes and the following attributes:
href | href="uri#location" | Specifies the target location |
type | type="contentType " | Content type of the targer document - this helps the user agent save on loading documents that it cannot process |
charset | charset="charset" | Encoding method of the link source |
hreflang | hreflang="langCode " | Code of the language of the target document |
rel | rel="linkType" | Forward link type of the target document |
rev | rev="linkType" | Reverse link type of the target document |
target | target="frameTarget" | specifies the frame where the referenced document is to be displayed |
media | media="media" | specifies the medium on which the referenced document is to be displayed |