Description

The <link> tag defines a link between the current document and an external resource.

The <link> element may only appear in the head section of a document, although it may appear any number of times. It is mostly used in linking style sheets to the HTML document.

The following table summarizes the usages context and the version history of this tag.

Parent:<head>
Content:None. It is an empty element.
Start/ End Tag:Start tag: required, End tag: forbidden
Version:HTML 2, 3.2, 4, 4.01, 5

Syntax

The basic syntax of the <link> tag is given with:

HTML:<link rel="link-type" href="URL">
XHTML:<link rel="link-type" href="URL" />

The example below shows the <link> tag in action.

<head>
    <title>HTML Document</title>
    <link rel="stylesheet" href="default.css">
</head>                         

Note: When used for referencing external style sheets, the element is supported in all major browsers, but there's no real support for anything else.

Tag-Specific Attributes

The following table shows the attributes that are specific to the <link> tag.

Global Attributes

Like all other HTML tags, the <link> tag supports the global attributes in HTML5.

Event Attributes

The <link> tag also supports the event attributes in HTML5.

Browser Compatibility

Element
<link>YesYesYesYesYes