HTML <link> tag

HTML <link> tag is used to specify the relationship between the current document and external source.

The <link> tag is commonly used to link the external Stylesheet for the current document, but it can also use with link site icons. It is placed on the head section of the document.

Example

Following are some specifications about the HTML <link> tag

DisplayNone
Start tag/End tagBoth Start and End tag
Usagetextual

Example

Test it Now

Output:

HTML link tag

Attribute:

Tag-specific attributes:

AttributeValueDescription
charsetchar_encodingIt defines the character encoding of linked source. (Not supported in HTML5)
hrefURLIt specifies the location of the linked document.
hreflanglanguage_codeSpecifies the text language of linked source.
mediamedia_queryIt specifies the media, for which linked source is applied.
rel
  • alternate
  • author
  • dns-prefetch
  • help
  • icon
  • license
  • next
  • pingback
  • preconnect
  • prefetch
  • preload
  • prerender
  • prev
  • search
  • stylesheet
It describes the relationship between the current document and linked document. (required)
revreversed
relationship
It describes the relationship between the linked document and the current document. (Not supported in HTML5)
sizesHeight* weightIt specifies the size of the linked source. It should be only used with rel="icon."
target_blank
_self
_top
_parent
frame_name
It determines where to load the linked document.
typemedia_typeIt specifies the media type of document.

Global attribute:

The <link> tag supports the global attributes in HTML

Event attribute:

The <link > tag supports the event attributes in HTML.

Supporting Browsers

Elementchrome browser Chromeie browser IEfirefox browser Firefoxopera browser Operasafari browser Safari
<link>YesYesYesYesYes
Next TopicHTML Tags List