link ElementThe link element is declared by the XHTML 1.1 Link Module
This is the only element in this Module.
The link element allows the author to specify URIs
which are related to the current document: parent
documents, glossaries, search pages, etc. Either the
rel or rev attribute can be used, depending
on the direction of the relationship. For more information
see the LinkTypes Attribute Type.
link elements may be placed only within the
head element and are not rendered as part of the
document content, although user agents may allow
certain LinkTypes to be accessed by the user
through other means - for example, in
*Opera, by using the
"Navigation Bar". Search engines may possibly make use
of certain LinkTypes to determine the structure
of a site and some browsers may prefetch rel="next"
pages to speed up browsing - see, for example
*Mozilla - Link prefetching FAQ,
where rel="prefetch" can also be used.
Users who wish to disable link prefetching in Firefox (e.g. for privacy, security or bandwidth reasons)
can go to about:config and set network.prefetch-next
to false.
For example:
<head>
<title>Page 2: Getting Started</title>
<link rel="prev" href="/en/p1.html" title="Page 1: Introduction" />
<link rel="next" href="/en/p3.html" title="Page 3: Advanced Use" />
<link rel="glossary" href="/en/glossary.html" />
<link rel="alternate" hreflang="de" href="/de/p2.html" title="German Version of this Page" />
<link rel="search" href="/search" />
</head>
If rel is given the value "stylesheet" (or "alternate stylesheet")
the linked URI should specify a stylesheet which may be used when rendering the
document. The type attribute should then be added, stating
the MIME type of the stylesheet language (usually "text/css"). Optionally, the
media attribute may be used to indicate the media type(s) for which the
stylesheet applies (see the MediaDesc attribute type) and/or a
title attribute can be added to designate the stylesheet as either
the preferred author style (with rel="stylesheet") or as an alternative
style (with rel="alternate stylesheet"). Without a title attribute,
linked stylesheets are persistent - i.e. they are always loaded.
See the W3C Recommendation
*HTML 4.01 - External style sheets
for more information.
Note that relative paths in external CSS stylesheets (e.g. when specifying background images) are with respect to the stylesheet's URI and not the document's base URI.
For example:
In XHTML which is not served as "text/html", you can alternatively use *xml-stylesheet processing instructions to specify your styles. XML processing instructions should come after any XML declaration but before the DOCTYPE (see XML Declaration & DOCTYPE).
For example:
<?xml-stylesheet type="text/css" href="/style/style.css"?>
<?xml-stylesheet type="text/css" href="/style/normal.css" title="Normal (Preferred Style)"?>
<?xml-stylesheet alternate="yes" type="text/css" href="/style/high.css" title="High Contrast (Alternate Style)"?>
There are no #REQUIRED attributes on the link element.
link element are listed below:charset [ type Charset ]href [ type URI ]hreflang [ type LanguageCode ]href attributemedia [ type MediaDesc ]rel [ type LinkTypes ]href attribute - e.g. a value of "stylesheet" specifies that the resource is a stylesheet for the current document (if desired, a space separated list of relationships may be given)rev [ type LinkTypes ]href attribute - i.e. the relationship from that other resource to the current document - e.g. a value of "glossary" specifies that the current document is a glossary for the resource (if desired, a space separated list of relationships may be given)type [ type ContentType ]target [ type FrameTarget ]link element are listed below:class [ type NMTOKENS ]id [ type ID ]style [ type CDATA ], from the Style Attribute Module (deprecated)title [ type Text ]xmlns [ type URI - #FIXED 'http://www.w3.org/1999/xhtml' ]dir [ type Enumeration (ltr | rtl) ], from the Bi-directional Text Modulexml:lang [ type LanguageCode ]All attributes in the
Events Attribute Collection
are supported:onclick, ondblclick, onmousedown, onmouseup, onmouseover, onmousemove, onmouseout, onkeypress, onkeydown, onkeyup
link element is:
EMPTY
See Content Model & Nesting for information about Content Model syntax and Nesting Groups.
linkThis element is empty and may have no children.
linkhead