HTML <link> (Link to External Resource File) Tag

❮ Previous Reference Next ❯

Example

<head>
  <link rel="stylesheet" href="demo.css">
</head>

Meaning

The <link> empty element found in the head element specifies relationships between the current document and other documents.

Possible uses for this element include defining a relational framework for navigation and linking the document to a style sheet.

Notes:

Version: HTML 2, 3.2, 4, 4.01, 5


Standard Syntax

HTML: <link rel="linkType" href="URL">

XHTML: <link rel="linkType" href="URL" />



Browser Support




Status







Attributes

Attribute Value Description
as audio
document
embed
fetch
font
image
object
script
style
track
video
worker
Specifies the type of content being loaded.
crossorigin anonymous
use-credentials
Specifies whether CORS must be used when fetching the resource.
href URL Specifies a URL that provides the destination of the link.
hreflang languageCode The language of the destination of the hyperlink.
imagesizes sizes
srcset
Specifies to preload the appropriate resource used by an img element.
imagesrcset sizes
srcset
Specifies to preload the appropriate resource used by an img element.
media mediaQuery The media for which the destination of the hyperlink was designed.
referrerpolicy no-referrer
no-referrer-when-downgrade
origin
origin-when-cross-origin
unsafe-url
Specifies which referrer to use when fetching the resource.
rel alternate
author
dns-prefetch
help
icon
license
next
pingback
preconnect
prefetch
preload
prerender
prev
search
stylesheet
Required. rel attribute names a relationship between the linked document and the current document.
sizes HeightxWidth
any
The sizes attribute is used with the icon link type. The attribute must not be specified on link elements that do not have a rel attribute that specifies the icon keyword.
title text the title attribute defines alternative style sheet sets.
type mediaType A valid MIME type that destination of the hyperlink.



Deprecated attributes

Attribute Value Description
charset characterSet Specifies the character encoding of the linked resource.
rev rel value (revision)Specifies the relationship of the current document to the linked document, as defined by the href attribute.



Global Attributes

<link> element also supports the Global Attributes in HTML.


Event Attributes

<link> element also supports the Event Attributes in HTML.




By Default CSS Value(s)

Most of the browsers will display the <link> element with the following by default value(s)

link {
  display: none;
}



Related Tags:

<base>, <head>, <meta>, <style> and <title>
❮ Previous Reference Next ❯