Producing web pages
* HTML CSS DHTML XHTML A to Z of tags        Accessibility          Design

<link>

<link
charset=charset
class=type
dir=ltr|rtr
href=url
hreflang=language
id=value
media=value
rel=forward link type
rev=reverse link type
target=name
title=title
type=type
</link>

Establishes a hierarchical organisation for navigating between pages. This tag wasn’t used much until recently, but you now use it to link to a style sheet. You can also use it to link to related indexes and glossaries, older versions of pages and so on.

You must use the <link> tag within the <head> tag. The <head> tag may contain several <link> tags.

Attributes

charset=charset

The character set encoding. An example is ISO-8859-1 (often called Latin-1). This character set covers the most common characters in western European languages.

class=type

Indicates the class to which the tag belongs. You can use the class attribute in a style sheet to create different styles that you want apply to a single HTML tag. For example, you might create three different styles for a list item <link> tag. See Using the class attribute as a selector for more details.

dir=ltr|rtr

Specifies the direction of text. This can be left-to-right (ltr) or right-to-left (rtl). For example, English characters are presented left-to-right, Hebrew characters are presented right-to-left.

href=url

Specifies the URL that has a relationship to the current page. This might be a style sheet or the author’s email address.

hreflang=language

Specifies which language the link <link> tag uses. You can enter any valid ISO standard language abbreviation, for example, “en” for English, “de” for German and so on. For example, <span lang="es">hola! como esta?</span>.

This attribute helps search engines understand different languages as different languages rather than just misspelled English. It may also help spelling and grammar checkers and allow speech synthesizers to use language-dependent pronunciation rules.

id=value

Specifies a unique name for the tag. No two tags can have the same id on a single page. The value must begin with a letter followed by any alphanumeric character, a hyphen, an underscore, a colon or a full stop. You use it to reference a unique style for a tag or to manipulate the tag with a script.

media=value

Specifies which medium to want the style sheet to apply to:

Value…

Description…

Screen

This is the default. Applies to the screen

Print

For output to a printer

Projection

For projected presentations

Braille

For Braille devices

TTY

For character cell displays (uses fixed-width font)

TV

For televisions

All

For all devices

rel=forward link type

Specifies the type of page to which you want to make the link.

Value…

Description…

Alternate

Substitute version of the file that contains the link

Appendix

Page that is an appendix for the set of pages

Bookmark

Bookmark

Chapter

Page is a chapter for a set of pages

Contents

Table of contents document

Copyright

Copyright notice for the current page

Glossary

Glossary for the current page

Help

Help document

Index

Index document for the current page

Next

Next document in a sequence

Prev

Previous document in a sequence

Section

Page is a section for a set of pages

Start

First document of a set

Stylesheet

Style sheet

Subsection

Page is a subsection for a set of pages

rev=reverse link type

Indicates that the page to which there is a link has a reverse link from the target back to the source page.

target=name

You can associate a name with browser windows and frames that links can refer to. When you click on the link, the browser displays the destination page in the named window or frame. Only supported by browsers that can handle frames.

The target can be one of the following:

Value…

Description…

name

Loads the link into the window or frame with this name. The name must begin with an alphanumeric character

_blank

Load page into a new blank window

_parent

Load the page into the immediate parent of the page

_self

Load the page into the current window

_top

Load the page into the full body of the window

title=title

For information only. Some browsers display the title when you move the mouse over the tag (like a tool tip).

type=type

Specifies the Internet media type and associated parameters for the linked style sheet. This allows the user agent to disregard style sheets in unsupported notations, without the need to first make a remote query across the network.