HTML Tag Reference - HTML tag <link>








This element defines the relationship between the current page and external documents. It links external style sheets to the current the document. <link> is usually placed in the <head> section of the page.

Browser compatibility

<link> Yes Yes Yes Yes Yes

What's new in HTML5

Some HTML 4.01 attributes are deprecated in HTML5. The "sizes" attribute is new in HTML5.





Attribute

Attribute Value Description
charset char_encoding Not supported in HTML5.
Set the character encoding of the linked document
href URL Set the location of the linked document
hreflang language_code Set the language used for the linked document
media media_query Set media type for the linked document
rel alternate
archives
author
bookmark
external
first
help
icon
last
license
next
nofollow
noreferrer
pingback
prefetch
prev
search
sidebar
stylesheet
tag
up
Required. Set the relationship between the current document and the linked document
rev reversed relationship Not supported in HTML5.
Set the relationship between the linked document and the current document
sizes HeightxWidth
any
Set the size of the linked resource. Only valid for rel="icon"
target _blank
_self
_top
_parent
frame_name
Not supported in HTML5.
Set where to load the linked document
type media_type Set the media type of the linked document




Global Attributes

The <link> tag supports the Global Attributes in HTML.

Event Attributes

The <link> tag supports the Event Attributes in HTML.

Default CSS Settings

link {
    display: none;
}

Example

A demo showing how to use <link> tag.

<html>
<head>
    <link rel="stylesheet" href="myStyleSheet.css" type="text/css">
</head>
<body>
    This text will have the font specified in myStyleSheet
</body>
</html>