Text Formatting
HTML <link> Tag
The <link> tag defines the relationship between the current document and an external resource.
Definition and Usage
The <link> tag defines the relationship between the current document and an external resource.
Standard Syntax:
<link>Interactive ExampleRunnable
HTML <link> Example
htmlLive code demonstration for the <link> tag. Click "Try it Yourself" to edit and experiment in real time.
<div style="font-family: system-ui, sans-serif; padding: 16px; background: #ffffff; border-radius: 8px; border: 1px solid #e2e8f0; color: #0f172a;">
<head>
<link rel="stylesheet" href="styles.css">
</head>
</div>Attributes for <link>
9 Supported Attributes| Attribute | Values | Default | Description |
|---|---|---|---|
| crossorigin | anonymoususe-credentials | none | Specifies how the element handles cross-origin requests |
| href | URL | none | Specifies the location of the linked document |
| hreflang | language_code | none | Specifies the language of the text in the linked document |
| media | media_query | none | Specifies on what device the linked document will be displayed |
| referrerpolicy | no-referrerno-referrer-when-downgradeorigin origin-when-cross-originunsafe-url | none | Specifies which referrer to use when fetching the resource |
| rel | alternate author dns-prefetchhelp icon license next pingbackpreconnect prefetchpreloadprerender prev search stylesheet | none | Required. Specifies the relationship between the current document and the linked document |
| sizes | HeightxWidth any | none | Specifies the size of the linked resource. Only for rel="icon" |
| title | string | none | Defines a preferred or an alternate stylesheet |
| type | media_type | none | Specifies the media type of the linked document |
Global Attributes
The <link> tag also supports the standard global attributes in HTML, including class, id, style, title, hidden, and data-*.
Event Attributes
The <link> tag supports event attributes in HTML, such as onclick, onmouseover, onfocus, and more.
Browser Compatibility
ChromeEdgeFirefoxSafariOpera
More Tags in Text Formatting
View All 123Tags →<abbr>The <abbr> tag defines an abbreviation or an acronym, like "HTML", "CSS", "Mr.", "Dr.", "ASAP", "ATM".<acronym>Well organized and easy to understand Web building tutorials with lots of examples of how to use HTML, CSS, JavaScript, SQL, Python, PHP, Bootstrap, Java, XML and more.<b>The <b> tag specifies bold text without any extra importance.<basefont>Well organized and easy to understand Web building tutorials with lots of examples of how to use HTML, CSS, JavaScript, SQL, Python, PHP, Bootstrap, Java, XML and more.<bdi>BDI stands for Bi-Directional Isolation.<bdo>BDO stands for Bi-Directional Override.