Tag Description
The link tag is used to define the relationship between a document and an external resource (usually a link to an external style sheet).
This tag has the form:
<link href="URL"
media="media types"
rel="relationship"
rev="relationship"
type="content type" />
Note: The <link>
tag must be placed within the head element.
HTML5 and HTML4.01 Differences
Some HTML4.01 attributes are not supported in HTML5.
The "sizes" attribute is new in HTML5.
HTML5 | = New for HTML5 |
Attributes
Attribute | Value | Description |
---|---|---|
charset | char_encoding | Specifies the character encoding of the linked document
HTML4:
![]()
HTML5:
![]() |
href | URL | Specifies the location of the linked document |
hreflang | lang_code | Specifies the language of the text in the linked document |
media | screen tty tv projection handheld braille aural all |
Specifies on what device the linked document will be displayed |
rel | alternate appendix bookmark chapter contents copyright glossary help home index next prev section start stylesheet subsection |
Specifies the relationship between the current document and the linked document |
rev | alternate appendix bookmark chapter contents copyright glossary help home index next prev section start stylesheet subsection |
Specifies the relationship between the linked document and the current document
HTML4:
![]()
HTML5:
![]() |
sizesHTML5 | number any |
Specifies the sizes of the linked resource |
target | _blank _self _top _parent frame_name |
Specifies where the linked document is to be loaded
HTML4:
![]()
HTML5:
![]() |
type | media_type | Specifies the MIME type of the linked document |
Global Attributes
This tag also supports the HTML Global Attributes.
Event Attributes
This tag also supports the HTML Event Attributes.
Examples
The following example shows the basic use of this tag:
<head>
<link rel="stylesheet" type="text/css" href="styles.css" />
</head>
Browser Support
Chrome | Firefox | IE | Safari | Opera |
---|---|---|---|---|
Doctype Declaration Support
The following table lists the doctype declarations this element may appear in:
HTML4.01 / XHTML1.0 | XHTML 1.1 | HTML 5 | ||
---|---|---|---|---|
Traditional | Strict | Frameset | ||
Miscellaneous Information
Defined In: | HTML 2 |
---|---|
Empty Tag: | Yes |