Favorites

HTML <link> Tag

<link>
HTML TagThis tag is supported by all modern browsers.
Updated 22nd November 2026

The <link> tag connects the page to an external resource, most often a CSS style sheet, but also icons, preloads and alternate versions of the page.

Looks like you're using an ad blocker, and that's fine! Ads help keep CSS Portal's generators and references free, so if the site's useful to you, visit our Support page to see other ways to help.

Description

The <link> tag in HTML is used to define a relationship between the current document and an external resource. It is most commonly used to link external stylesheets to a web page, enabling the separation of content (HTML) from presentation (CSS). By using <link>, developers can modularize their code, reuse styles across multiple pages, and keep the HTML document clean and maintainable.

The <link> tag is void, meaning it does not have a closing tag, and it is typically placed within the <head> section of the document. Its primary purpose is to provide metadata about the document or to include external resources, such as stylesheets, icons, prefetching instructions, or alternate versions of content.

Because it resides in the <head>, the <link> tag allows browsers to process the resource before rendering the page, which is particularly important for stylesheets to prevent rendering content without styles (avoiding a flash of unstyled content). While the most common usage is linking CSS files, <link> can also point to fonts, RSS feeds, touch icons, or other external resources, enhancing both functionality and performance of web pages.

Properties

Permitted Parents
Any element that accepts metadata elements. If itemprop is present: any element that accepts phrasing content
Content
None. It is an empty element.
Start/End Tags
Start tag: required, End tag: forbidden

Example

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

Attributes

as
Sets the type of content being preloaded with rel="preload" or rel="modulepreload", such as script, style, font or image.
blocking
Marks the element as render-blocking, so the page is not painted until it has loaded.

Possible Values:
  • render
color
The color the browser can use when showing a pinned-site or mask icon.
crossorigin
Sets how the resource is requested across origins (CORS).

Possible Values:
  • anonymous
  • use-credentials
disabled
Disables a linked style sheet (rel="stylesheet").
fetchpriority
Hints how important this resource is compared with others of the same type.

Possible Values:
  • high
  • low
  • auto (default)
href
Specifies the location of a Web resource, thus defining a link between the current element (the source anchor) and the destination anchor defined by this attribute.
hreflang
Specifies the base language of the resource designated by href and may only be used when href is specified.
imagesizes
Like sizes on <img>, used with imagesrcset.
imagesrcset
Like srcset on <img>, for preloading responsive images (rel="preload" as="image").
integrity
A hash of the resource's contents (Subresource Integrity). The browser refuses the file if it doesn't match.
media
Specifies the device the document will be displayed on. Possible values:
  • all
  • braille
  • print
  • projection
  • screen
  • speech
referrerpolicy
Controls how much referrer information is sent when fetching the resource or following the link.

Possible Values:
  • no-referrer
  • no-referrer-when-downgrade
  • origin
  • origin-when-cross-origin
  • same-origin
  • strict-origin
  • strict-origin-when-cross-origin
  • unsafe-url
rel
Describes the relationship between the current document and the destination URI.
  • alternate
  • appendix
  • bookmark
  • chapter
  • contents
  • copyright
  • glossary
  • help
  • home
  • index
  • next
  • prev
  • section
  • start
  • stylesheet
  • subsection
sizes
The sizes of the icons, e.g. 32x32 or any (for rel="icon").
type
The MIME type of content at the link destination.
target
Specifies the target frame to load the page into. This attribute is now deprecated.
charset
Specifies the character encoding of the linked resource. This attribute is now deprecated.

Global Attributes

The <link> tag also supports the Global Attributes in HTML5

Event Attributes

The <link> tag also supports the Event Attributes in HTML5

Browser Support

The following information will show you the current browser support for the HTML <link> tag. Hover over a browser icon to see the version that first introduced support for this HTML tag.

This tag is supported by all modern browsers.

Desktop

Chrome
Edge
Firefox
Opera
Safari

Tablets & Mobile

Chrome Android
Firefox Android
Opera Android
Safari iOS
Samsung Internet
Android WebView
-
Supported Unknown Not supported

Looks like you're using an ad blocker, and that's fine! Ads help keep CSS Portal's generators and references free, so if the site's useful to you, visit our Support page to see other ways to help.