``` --- ## Browser Support All major browsers support"> ``` --- ## Browser Support All major browsers support" />
Easy Tutorial
❮ Tag P Att Object Usemap ❯

HTML <link> Tag

Example

Link to an external style sheet:

<head>
<link rel="stylesheet" type="text/css" href="theme.css">
</head>

Browser Support

All major browsers support the <link> tag.


Tag Definition and Usage

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

The <link> tag is most commonly used to link to style sheets.

Note: The link element is an empty element, it contains attributes only.

Note: This element can only appear in the head section, though it can appear any number of times.


Differences Between HTML 4.01 and HTML5

Some HTML 4.01 attributes are not supported in HTML5.

HTML5 introduced the "sizes" attribute.


Differences Between HTML and XHTML

In HTML, the <link> tag has no end tag.

In XHTML, the <link> tag must be properly closed.


Attributes

Attribute Value Description
charset char_encoding Not supported in HTML5. Defines the character encoding of the linked document.
href URL Defines the location of the linked document.
hreflang language_code Defines the language of the text in the linked document.
media media_query Specifies on what device the linked document will be displayed.
rel alternate <br>archives <br>author <br>bookmark <br>external <br>first <br>help <br>icon <br>last <br>license <br>next <br>nofollow <br>noreferrer <br>pingback <br>prefetch <br>prev <br>search <br>sidebar <br>stylesheet <br>tag <br>up Required. Defines the relationship between the current document and the linked document. rel is short for relationship.
rev reversed relationship Not supported in HTML5. Defines the relationship between the linked document and the current document.
sizes New HeightxWidthany Defines the size of the linked resource. Only for rel="icon".
target _blank <br>_self <br>_top <br>_parent <br> frame_name Not supported in HTML5. Defines where to open the linked document.
type MIME_type Specifies the MIME type of the linked document.

Global Attributes

The <link> tag supports global attributes. See the complete list of HTML Global Attributes.


Event Attributes

The <link> tag supports all HTML Event Attributes.


Related Articles

HTML Tutorial: HTML Styles

HTML DOM Reference: Link Object

❮ Tag P Att Object Usemap ❯