Att Link Rel
## HTML `` `rel` Attribute
The `rel` attribute is a mandatory attribute of the `` element. It specifies the relationship between the current document and the linked document or resource.
Understanding and correctly using the `rel` attribute is essential for search engine optimization (SEO), performance optimization, and defining how browsers should interpret external resources.
---
## Syntax
```html
```
---
## Browser Support
The `rel` attribute is fully supported by all major modern web browsers:
* Google Chrome
* Mozilla Firefox
* Microsoft Edge / Internet Explorer
* Safari
* Opera
---
## Attribute Values
The following table lists the standard values for the `rel` attribute and their descriptions:
| Value | Description |
| :--- | :--- |
| `alternate` | Links to an alternate version of the document (e.g., a print page, a translation, or a mirror). |
| `author` | Links to the author of the document. |
| `help` | Links to a help document or user guide. |
| `icon` | Imports an icon (favicon) that represents the current document. |
| `license` | Links to copyright or licensing information for the document. |
| `next` | Indicates that the current document is part of a series, and the linked document is the next document in that series. |
| `prefetch` | Specifies that the target resource should be preemptively cached by the browser for future navigation. |
| `prev` | Indicates that the current document is part of a series, and the linked document is the previous document in that series. |
| `search` | Links to a search tool or resource search interface for the document. |
| `stylesheet` | Imports an external CSS stylesheet to style the current document. |
---
## Code Examples
### 1. Importing an External Stylesheet
This is the most common use case for the `` tag. It tells the browser to fetch and apply an external CSS file.
```html
```
### 2. Adding a Website Favicon
You can specify an icon that will appear in the browser tab, bookmarks, or mobile home screens.
```html
```
### 3. Specifying an Alternate Version (Translation)
If your website is available in multiple languages, you can use `alternate` combined with the `hreflang` attribute to point search engines to the translated versions.
```html
```
### 4. Resource Hinting (Prefetching)
You can optimize performance by telling the browser to download resources in the background before the user actually requests them.
```html
```
---
## Key Considerations
### HTML 4.01 vs. HTML5 Differences
* **Removed Values:** Several legacy values from HTML 4.01 (such as `appendix`, `chapter`, `section`, `subsection`, `start`, and `index`) have been deprecated or removed in HTML5.
* **New Values:** HTML5 introduced modern values like `author`, `license`, and performance-focused resource hints like `prefetch` to better align with modern web standards.
### Best Practices
* **Always Include `rel`:** The `` element is practically useless without the `rel` attribute, as browsers will not know how to process the linked resource.
* **Multiple Values:** You can specify multiple space-separated values within a single `rel` attribute if they apply (e.g., `rel="noopener noreferrer"` on anchor tags, or `rel="alternate stylesheet"` for style switchers).
YouTip