<link> tag in HTML
The <link> tag is used to defines a link between an HTML document and an external resource.
Important Description
- The <link> tag placed between <head> </head> tag.
- The <link> tag is an empty tag, it contains attributes only.
- The <link> tag is used to link to external style sheets.
- The <link> tag has no end tag in HTML BUT in XHTML must be closed like <link />.
Example of <link> tag
<link> Tag Browser Support
Element |
Chrome |
Edge |
Firefox |
Safari |
Opera |
<link> |
Yes |
Yes |
Yes |
Yes |
Yes |
Global Attributes
Event Attributes
Attributes
The 'charset', 'rev', 'target' attributes are not supported in HTML5:
Attribute |
Value |
Description |
crossorigin |
anonymous
use-credentials |
Defines how the element handles cross-origin requests |
href |
URL |
Defines the location of the linked document |
hreflang |
language_code |
Defines on what device the linked document will be displayed |
media |
media_query |
Defines on what device the linked document will be displayed |
rel |
alternate
author
dns-prefetch
help
icon
license
netx
pingback
preconnect
prefetch
preload
prerender
prev
search
stylesheet |
Defines onthe relationship between the current document and the linked document |
size |
HeightxWidth
any |
Defines the sizes of icons for visual media |
type |
media_type |
Defines the location of the linked document |