Make your own free website on Tripod.com

Back Main GuestBook Contact Music (JS) Appendix

<LINK> - Document Relationships

This element defines relationships between this document and another file. The tag appears in the document head, not the body, and is not rendered as part of the page. <LINK> is also used to link auxilary files to the HTML document--external style sheets and scripts, for example. <LINK> can also be used to provide other versions in different formats, in different languages, or for different media. Some browsers, notably Lynx and Mosaic, create tool bars based on the document's <LINK> elements.

It is illegal to close this tag. </LINK> does not exist.

Attributes for <LINK>

  %coreattrs %i18n %events

Structural Attributes

  href= [CS]
Gives location.
This attribute gives the location of the linked document.

  charset= [CI]
Gives the character encoding type.
This attribute tells the browser what character encoding the linked document uses.

  hreflang= [CI]
Gives language code.
This attribute tells the browser what language the linked document is written in. (Human language.)

  type= [CI]
Gives file type.
This attribute tells the browser what type of file is linked. A few examples: "text/html", "text/javascript", "text/css"

  rel= [CI]
Gives a space separated list of link types (or just one).
This attribute defines forward link types, expressing the relationship of this document to the linked one.

  rev= [CI]
Gives a space separated list of link types (or just one).
This attribute defines reverse link types, expressing the relationship of the linked document to this one. That would be the same value as rel on a link from the destination document back to this one.

  media= [CI]
Gives a comma separated list of media types.
This attribute tells the browser what sort of media the linked document is for so that it doesn't retrieve files it can't use. For instance, a graphical browser application won't need to retrieve files intended for a braille browser.

Samples:

You can link to a stylesheet: <LINK href="styles.css" type="text/css" rel="stylesheet" media="screen">
Or to a translated version of the page: <LINK href="JP/index.html" type="text/html" hreflang="ja-JP" charset="ISO-2022-JP" rel="alternate">

Here's a link that would appear at the top of this page: <LINK href="index.htm" type="text/html" hreflang="en" media="all" rel="contents" rev="section">
It gives the following information:

Code Meaning
Attribute Value
href index.htm The destination anchor is a file located in the same folder as this one and is named "index.htm".
type text/html "index.htm" is an HTML document.
hreflang en "index.htm" is written mainly in English.
media all "index.htm" is written for all media types.
rel contents "index.htm" is the table of contents for this collection of documents.
rev section This document ("link.htm") is a section of the collection including "index.htm".