The HTML <link> tag
Definition and Usage
<link>
The tag defines the relationship between the current document and an external resource.
<link>
The tag is most commonly used to link to an external stylesheet or to add an icon to a website.
<link>
The element is an empty element, it only contains attributes.
See Also:
HTML Tutorial:HTML Styles
HTML DOM Reference Manual:Link Object
Example
Link to an external stylesheet:
<head> <link rel="stylesheet" href="styles.css"> </head>
Attribute
Attribute | Value | Description |
---|---|---|
crossorigin |
|
Specify how the element handles cross-origin requests. |
href | URL | Specify the location of the linked document. |
hreflang | Voice Code | Specify the language of the text in the linked document. |
media | Media Queries | Specify on which device the linked document will be displayed. |
referrerpolicy |
|
Specify which referer to use when accessing the resource. |
rel |
|
Required. Specify the relationship between the current document and the linked document. |
sizes |
|
Specify the size of the linked resource. Only applicable for rel="icon". |
title | Defines the preferred or alternate stylesheet. | |
type | Media Type | Specifies the media type of the linked document. |
Global Attributes
<link>
The tag also supports Global Attributes in HTML.
event attributes
<link>
The tag also supports Event Attributes in HTML.
Default CSS Settings
Most browsers will use the following default values to display <link>
Element:
link { display: none; }
Browser Support
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
Support | Support | Support | Support | Support |