HTML <link> Tag
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
Attributes
- 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.
- type
- The MIME type of content at the link destination.
- 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
- target
-
Specifies the target frame to load the page into.
Possible Values:- _blank
- _self
- _top
- _parent
- media
-
Specifies the device the document will be displayed on. Possible values:
- all
- braille
- projection
- screen
- speech
- charset
- Specifies the character encoding of the resource designated by the link.
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
Tablets & Mobile
Last updated by CSSPortal on: 26th December 2025
