HTML link Tag
HTML link Tag
The link tag is used to define the relationship between the current document and an external resource. It is mostly used for linking CSS files or adding a favicon to the browser. The link tag is an empty element that contains only attributes. It does not have an ending tag as it is a self-closing tag.
Attribute Explanation:-
Attribute | Value | Description |
---|---|---|
crossorigin | anonymous use-credentials |
Specifies how element handles cross-origin requests. |
href | URL | Specifies location of linked document. |
hreflang | language_code | Specifies language of text in linked document. |
media | media_query | Specifies on what device linked document will be displayed. |
referrerpolicy | no-referrer no-referrer-when-downgrade origin origin-when-cross-origin unsafe-url |
Specifies which referrer to use when fetching resource. |
rel | alternate author dns-prefetch help icon license next pingback preconnect prefetch preload prerender prev search stylesheet |
Required. Specifies relationship between current document and linked document. |
sizes | HeightxWidth any |
Specifies size of linked resource. Only works with for rel="icon". |
title | Defines preferred or an alternate stylesheet. | |
type | media_type | Specifies media type of linked document. |
Syntax:-
Its syntax is:- < link >