The <link> rel attribute is an essential part of HTML that specifies the relationship between the current document and a linked document or resource. It is used in conjunction with the href attribute to define how the two documents relate to each other.
Syntax:
<link rel="value" href="URL">Attribute Values:
| Attribute | Description |
|---|---|
| alternate | Specifies an alternative link of the document, such as a print page, translated, or mirror. |
| author | Defines the author of the link. |
| dns-prefetch | Specifies that the browser should preemptively perform DNS resolution for the target resource's origin. |
| help | Specifies a link to a help document. |
| icon | Specifies an import icon in a given document. |
| license | Specifies a link to copyright information for the document. |
| next | Provides the link to the next document in the series. |
| pingback | Specifies the address of the pingback server. |
| preconnect | Specifies that the target should be preemptively connected to the origin resource. |
| prefetch | Specifies that the target document should be cached. |
| preload | Specifies that the browser must preemptively fetch and cache the resource. |
| prerender | Specifies that the browser should load and render the page in the background. |
| prev | Specifies the previous document in a selection. |
| search | Specifies the search tool for the document. |
| stylesheet | Imports a style sheet. |
Example of HTML link rel Attribute
Example 1: In this example, we are showing the example of link rel attribute in html.
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet"
type="text/css"
href="index_screen.css">
<link rel="stylesheet"
type="text/css"
href="index_print.css">
</head>
<body>
<center>
<h1>GeeksforGeeks</h1>
<p><a href="https://www.geeksforgeeks.org/community/"
target="_blank">
Click here
</a>
</center>
</body>
</html>
Importance of the <link> rel Attribute
By understanding and effectively using the HTML <link> rel attribute, you can improve user experience on your webpages. It helps define how your current document interacts with others, making it easier for browsers and search engines to understand and index your content.
Supported Browsers: The browsers supported by HTML rel Attribute are listed below