HTML attribute: rel #
::: section-content
The rel attribute defines the relationship between a linked resource
and the current document. Valid on
<link>,
<a>,
<area>, and
<form>, the supported values depend on the element
on which the attribute is found.
The type of relationships is given by the value of the rel attribute,
which, if present, must have a value that is an unordered set of unique
space-separated keywords. Differently from a class name, which does
not express semantics, the rel attribute must express tokens that are
semantically valid for both machines and humans. The current registries
for the possible values of the rel attribute are the
IANA link
relation
registry{target="_blank"},
the
HTML Living
Standard{target="_blank"},
and the freely-editable
existing-rel-values
page{target="_blank"}
in the microformats wiki,
as
suggested{target="_blank"}
by the Living Standard. If a rel attribute not present in one of the
three sources above is used some HTML validators (such as the
W3C
Markup Validation Service{target="_blank"})
will generate a warning.
The following table lists some of the most important existing keywords. Every keyword within a space-separated value should be unique within that value.
rel value | Description | <link> | <a> and <area> | <form> |
|---|---|---|---|---|
alternate | Alternate representations of the current document. | Link | Link | Not allowed |
author | Author of the current document or article. | Link | Link | Not allowed |
bookmark | Permalink for the nearest ancestor section. | Not allowed | Link | Not allowed |
canonical | Preferred URL for the current document. | Link | Not allowed | Not allowed |
dns-prefetch | Tells the browser to preemptively perform DNS resolution for the target resource's origin. | External Resource | Not allowed | Not allowed |
external | The referenced document is not part of the same site as the current document. | Not allowed | Annotation | Annotation |
help | Link to context-sensitive help. | Link | Link | Link |
icon | An icon representing the current document. | External Resource | Not allowed | Not allowed |
license | Indicates that the main content of the current document is covered by the copyright license. described by the referenced document. | Link | Link | Link |
manifest | Web app manifest. | Link | Not allowed | Not allowed |
me | Indicates that the current document represents the person who owns the linked content. | Link | Link | Not allowed |
modulepreload | Tells to browser to preemptively fetch the script and store it in the document's module map for later evaluation. Optionally, the module's dependencies can be fetched as well. | External Resource | Not allowed | Not allowed |
next | Indicates that the current document is a part of a series and that the next document in the series is the referenced document. | Link | Link | Link |
nofollow | Indicates that the current document's original author or publisher does not endorse the referenced document. | Not allowed | Annotation | Annotation |
noopener | Creates a top-level browsing context that is not an auxiliary
browsing context if the hyperlink would create either of those, to begin
with (i.e., has an appropriate target attribute
value). | Not allowed | Annotation | Annotation |
noreferrer | No Referer header will be included. Additionally, has
the same effect as noopener. | Not allowed | Annotation | Annotation |
opener | Creates an auxiliary browsing context if the hyperlink would
otherwise create a top-level browsing context that is not an auxiliary
browsing context (i.e., has "_blank" as target
attribute value). | Not allowed | Annotation | Annotation |
pingback | Gives the address of the pingback server that handles pingbacks to the current document. | External Resource | Not allowed | Not allowed |
preconnect | Specifies that the user agent should preemptively connect to the target resource's origin. | External Resource | Not allowed | Not allowed |
prefetch | Specifies that the user agent should preemptively fetch and cache the target resource as it is likely to be required for a followup navigation. | External Resource | Not allowed | Not allowed |
preload | Specifies that the user agent must preemptively fetch and cache the
target resource for current navigation according to the potential
destination given by the as attribute (and the
priority associated with the corresponding destination). | External Resource | Not allowed | Not allowed |
prerender | Specifies that the user agent should preemptively fetch the target resource and process it in a way that helps deliver a faster response in the future. | External Resource | Not allowed | Not allowed |
prev | Indicates that the current document is a part of a series and that the previous document in the series is the referenced document. | Link | Link | Link |
search | Gives a link to a resource that can be used to search through the current document and its related pages. | Link | Link | Link |
stylesheet | Imports a style sheet. | External Resource | Not allowed | Not allowed |
tag | Gives a tag (identified by the given address) that applies to the current document. | Not allowed | Link | Not allowed |
The rel attribute is relevant to the
<link>,
<a>,
<area>, and
<form> elements, but some values only relevant to a
subset of those elements. Like all HTML keyword attribute values, these
values are case-insensitive.
The rel attribute has no default value. If the attribute is omitted or
if none of the values in the attribute are supported, then the document
has no particular relationship with the destination resource other than
there being a hyperlink between the two. In this case, on
<link> and
<form>, if the
rel attribute is absent, has no keywords, or if not one or more of the
space-separated keywords above, then the element does not create any
links.
<a> and
<area> will still
created links, but without a defined relationship.
:::
Values #
::: section-content
alternateIndicates an alternate representation of the current document. Valid for
<link>,<a>, and<area>, the meaning depends on the values of the other attributes.With the
stylesheetkeyword on a<link>, it creates an alternate stylesheet.::: code-example [html]{.language-name}
<!-- a persistent style sheet --> <link rel="stylesheet" href="default.css" /> <!-- alternate style sheets --> <link rel="alternate stylesheet" href="highcontrast.css" title="High contrast" />:::
With an
hreflangattribute that differs from the document language, it indicates a translation.With the
typeattribute value of"application/rss+xml"or"application/atom+xml", it creates a hyperlink referencing a syndication feed.::: code-example [html]{.language-name}
<link rel="alternate" type="application/atom+xml" href="posts.xml" title="Blog" />:::
Otherwise, it creates a hyperlink referencing an alternate representation of the current document, whose nature is given by the
hreflangandtypeattributes.- If
hreflangis given alongsidealternate, and the value ofhreflangis different from the current document's language, it indicates that the referenced document is a translation. - If
typeis given alongsidealternate, it indicates that the referenced document is an alternative format (such as a PDF). - The
hreflangandtypeattributes may both be given alongsidealternate.
::: code-example [html]{.language-name}
<link rel="alternate" href="/fr/html/print" hreflang="fr" type="text/html" media="print" title="French HTML (for printing)" /> <link rel="alternate" href="/fr/pdf" hreflang="fr" type="application/pdf" title="French PDF" />:::
- If
authorIndicates the referenced document provides further information about the author of the current document or article. Relevant for
<link>,<a>, and<area>elements.With
<a>and<area>, it indicates the linked document (ormailto:) provides information about the author of the nearest<article>ancestor if there is one, otherwise the entire document.With
<link>, it represents the author of the entire document.::: {#sect1 .notecard .note} Note: For historical reasons, the obsolete attribute value
rev="made"is treated asrel="author". :::bookmarkRelevant as the
relattribute value for the<a>and<area>elements. Gives a permalink for the nearest ancestor<article>element, if there is one. If there is no ancestor<article>element, gives a permalink for the section the linking element is most closely associated with.canonicalValid for
<link>, it defines the preferred URL for the current document, which helps search engines reduce duplicate content.dns-prefetchRelevant for the
<link>element both in the<body>and<head>, it tells the browser to preemptively perform DNS resolution for the target resource's origin. Useful for resources the user will likely need, it helps reduce latency and thereby improves performance when the user does access the resources as the browser preemptively performed DNS resolution for the origin of the specified resource. See dns-prefetch described in resource hints{target="_blank"}.externalRelevant to
<form>,<a>, and<area>, it indicates the referenced document is not part of the current site. This can be used with attribute selectors to style external links in a way that indicates to the user that they will be leaving the current site.helpRelevant to
<form>,<link>,<a>, and<area>, thehelpkeyword indicates that the linked to content provides context-sensitive help, providing information for the parent of the element defining the hyperlink, and its children. When used within<link>, the help is for the whole document. When included with<a>and<area>and supported, the defaultcursorwill behelpinstead ofpointer.iconValid with
<link>, the linked resource represents the icon, a resource for representing the page in the user interface, for the current document.The most common use for the
iconvalue is the favicon:::: code-example [html]{.language-name}
<link rel="icon" href="favicon.ico" />:::
If there are multiple
<link rel="icon">s, the browser uses theirmedia,type, andsizesattributes to select the most appropriate icon. If several icons are equally appropriate, the last one is used. If the most appropriate icon is later found to be inappropriate, for example because it uses an unsupported format, the browser proceeds to the next-most appropriate, and so on.::: {#sect2 .notecard .note} Note: The
crossoriginattribute is not supported forrel="icon"in Chromium-based browsers. See the open Chromium issue{target="_blank"}. :::::: {#sect3 .notecard .note} Note: Apple's iOS does not use this link type, nor the
sizesattribute, like others mobile browsers do, to select a webpage icon for Web Clip or a start-up placeholder. Instead it uses the non-standardapple-touch-icon{target="_blank"} andapple-touch-startup-image{target="_blank"} respectively. :::::: {#sect4 .notecard .note} Note: The
shortcutlink type is often seen beforeicon, but this link type is non-conforming, ignored and web authors must not use it anymore. :::licenseValid on the
<a>,<area>,<form>,<link>elements, thelicensevalue indicates that the hyperlink leads to a document describing the licensing information; that the main content of the current document is covered by the copyright license described by the referenced document. If not inside the<head>element, the standard doesn't distinguish between a hyperlink applying to a specific part of the document or to the document as a whole. Only the data on the page can indicate this.::: code-example [html]{.language-name}
<link rel="license" href="#license" />:::
::: {#sect5 .notecard .note} Note: Although recognized, the synonym
copyrightis incorrect and must be avoided. :::manifest[Experimental]{.visually-hidden}Web app manifest. Requires the use of the CORS protocol for cross-origin fetching.
modulepreloadUseful for improved performance, and relevant to the
<link>anywhere in the document, settingrel="modulepreload"tells the browser to preemptively fetch the script (and dependencies) and store it in the document's module map for later evaluation.modulepreloadlinks can ensure network fetching is done with the module ready (but not evaluated) in the module map before it is necessarily needed. See alsomodulepreload.nextRelevant to
<form>,<link>,<a>, and<area>, thenextvalues indicates that the current document is a part of a series, and that the next document in the series is the referenced document. When included in a<link>, browsers may assume that document will be fetched next, and treat it as a resource hint.nofollowRelevant to
<form>,<a>, and<area>, thenofollowkeyword tells search engine spiders to ignore the link relationship. The nofollow relationship may indicate the current document's owner does not endorse the referenced document. It is often included by Search Engine Optimizers pretending their link farms are not spam pages.noopenerRelevant to
<form>,<a>, and<area>, creates a top-level browsing context that is not an auxiliary browsing context if the hyperlink would create either of those to begin with (i.e., has an appropriatetargetattribute value). In other words, it makes the link behave as ifwindow.openerwere null andtarget="_parent"were set.This is the opposite of
opener.noreferrerRelevant to
<form>,<a>, and<area>, including this value makes the referrer unknown (noRefererheader will be included), and creates a top-level browsing context as ifnoopenerwere also set.openerCreates an auxiliary browsing context if the hyperlink would otherwise create a top-level browsing context that is not an auxiliary browsing context (i.e., has "
_blank" astargetattribute value). Effectively, the opposite of noopener.pingbackGives the address of the pingback server that handles pingbacks to the current document. See the Pingback specification{target="_blank"}.
preconnectProvides a hint to the browser suggesting that it open a connection to the linked website in advance, without disclosing any private information or downloading any content, so that when the link is followed the linked content can be fetched more quickly.
prefetchSpecifies that the user agent should preemptively fetch and cache the target resource as it is likely to be required for a followup navigation. See prefetch for more information.
preloadSpecifies that the user agent must preemptively fetch and cache the target resource for current navigation according to the potential destination given by the
asattribute (and the priority associated with the corresponding destination). See the page for thepreloadvalue.prerender[Deprecated]{.visually-hidden} [Non-standard]{.visually-hidden}Specifies that the user agent should preemptively fetch the target resource and process it in a way that helps deliver a faster response in the future, for example by fetching its subresources or performing some rendering.
prevSimilar to the
nextkeyword, relevant to<form>,<link>,<a>, and<area>, theprevvalues indicates that the current document is a part of a series, and that the link references a previous document in the series is the referenced document.Note: The synonym
previousis incorrect and should not be used.searchRelevant to
<form>,<link>,<a>, and<area>elements, thesearchkeywords indicates that the hyperlink references a document whose interface is specially designed for searching in the current document, site, and related resources, providing a link to a resource that can be used to search.If the
typeattribute is set toapplication/opensearchdescription+xmlthe resource is an OpenSearch plugin that can be easily added to the interface of Firefox.stylesheetValid for the
<link>element, it imports an external resource to be used as a stylesheet. Thetypeattribute is not needed as it's atext/cssstylesheet, as that is the default value. If it's not a stylesheet of typetext/cssit is best to declare the type.While this attribute defines the link as being a stylesheet, the interaction with other attributes and other key terms within the rel value impact whether the stylesheet is downloaded and/or used.
When used with the
alternatekeyword, it defines an alternative style sheet. In this case, include a non-emptytitle.The external stylesheet will not be used or even downloaded if the media does not match the value of the
mediaattribute.Requires the use of the CORS protocol for cross-origin fetching.
tagValid for the
<a>, and<area>elements, it gives a tag (identified by the given address) that applies to the current document. The tag value denotes that the link refers to a document describing a tag applying to the document on which it is located. This link type is not meant for tags within a tag cloud, as those tags apply to a group of pages, whereas thetagvalue of therelattribute is for a single document. :::
Non-standard values #
::: section-content
apple-touch-iconSpecifies the icon for a web application on an iOS device. :::
Specifications #
::: _table #
Specification #
HTML Standard
[#
linkTypes]{.small}
:::
Browser compatibility #
::: _table #
Desktop Mobile
Chrome Edge Firefox Internet Opera Safari WebView Chrome Firefox for Opera Safari Samsung
Explorer Android Android Android Android on IOS Internet
rel 16 12 30 Yes 15 5 4.4 18 30 14 4.2 1.0
noopener 49 79 52 No 36 10.1 49 49 52 36 10.3 5.0
Before Firefox 63, Before Firefox 63,
`rel="noopener"` `rel="noopener"`
created windows created windows
with all features with all features
disabled by disabled by
default. Starting default. Starting
with Firefox 63, with Firefox 63,
these windows have these windows have
the same features the same features
enabled by default enabled by default
as any other as any other
window. window.
noreferrer 16 13 33 11 15 5 4.4 18 33 14 4.2 1.5
Only supported
in IE11 in
later versions
of Windows 10
(creators
update). (Per
caniuse.com.)
:::
::: _table #
Desktop Mobile
Chrome Edge Firefox Internet Opera Safari WebView Chrome Firefox for Opera Safari Samsung
Explorer Android Android Android Android on IOS Internet
rel 1 12 1 Yes 15 1 4.4 18 4 14 1 1.0
noopener 49 79 52 No 36 10.1 49 49 52 36 10.3 5.0
Before Firefox 63, Before Firefox 63,
`rel="noopener"` `rel="noopener"`
created windows created windows
with all features with all features
disabled by disabled by
default. Starting default. Starting
with Firefox 63, with Firefox 63,
these windows have these windows have
the same features the same features
enabled by default enabled by default
as any other as any other
window. window.
noreferrer 16 13 33 11 15 5 4.4 18 33 14 4.2 1.5
Only supported
in IE11 in
later versions
of Windows 10
(creators
update). (Per
caniuse.com.)
:::
::: _table #
Desktop Mobile
Chrome Edge Firefox Internet Opera Safari WebView Android Chrome Android Firefox for Android Opera Safari on IOS Samsung Internet
Explorer Android
rel 1 12 1 Yes 9 1 4.4 18 4 10.1 1 1.0
alternate_stylesheet 1–48 No 3 8 15–35 No 4.4–48 18–48 4 14–35 No 1.0–5.0
dns-prefetch 46 ≤79 3 No 33 No 46 Yes 4 No No Yes
icon 4 12 2 11 9 3.1 38 18 4 No No 4.0
If both ICO and PNG In version 79 and Before Firefox 83, the `crossorigin` In version 15 If both ICO and Does not use
are available, will later (Blink-based attribute is not supported for and later PNG are favicons at all
use ICO over PNG if Edge), if both ICO and `rel="icon"`. (Blink-based available, will (but may have
ICO has better PNG are available, Opera), if both ALWAYS use ICO alternative for
matching sizes set. will use ICO over PNG ICO and PNG are file, bookmarks,
(Per caniuse.com.). if ICO has better available, will regardless of etc.). (Per
matching sizes set. use ICO over sizes set. (Per caniuse.com.)
(Per caniuse.com.) PNG if ICO has caniuse.com.)
better matching
sizes set. (Per
caniuse.com.)
manifest No No No No No No 39 39 No No No 4.0
modulepreload 66 ≤79 115 No 53 No 66 66 115 47 No 9.0
preconnect 46 79 39 No 33 11.1 46 46 39 33 11.3 4.0
Before Firefox 41, it doesn\'t obey the Before Firefox 41, it doesn\'t obey the
`crossorigin` attribute. `crossorigin` attribute.
prefetch 8 12 2 11 15 13.1 4.4 18 4 14 13.4 1.5
Requires secure Requires secure Requires secure context Requires secure Requires secure context Requires secure Requires secure context Requires Requires secure context
context context context context secure
context
preload 50 ≤79 85 No 37 No 50 50 85 No No 5.0
Doesn't support Doesn't support 56--57 `as="document"` is unsupported. See Doesn't support 56--57 `as="document"` is unsupported. See
`as="audio"`, `as="audio"`, [bug `as="audio"`, [bug
`as="audioworklet"`, `as="audioworklet"`, Disabled due to various web 593267](https://crbug.com/593267). `as="audioworklet"`, Disabled due to various web 593267](https://crbug.com/593267).
`as="document"`, `as="document"`, compatibility issues (e.g. [bug `as="document"`, compatibility issues (e.g. [bug
`as="embed"`, `as="embed"`, 1405761](https://bugzil.la/1405761)). `as="embed"`, 1405761](https://bugzil.la/1405761)).
`as="manifest"`, `as="manifest"`, `as="manifest"`,
`as="object"`, `as="object"`, `as="object"`,
`as="paintworklet"`, `as="paintworklet"`, `as="paintworklet"`,
`as="report"`, `as="report"`, `as="report"`,
`as="sharedworker"`, `as="sharedworker"`, `as="sharedworker"`,
`as="video"`, `as="video"`, `as="video"`,
`as="worker"`, or `as="worker"`, or `as="worker"`, or
`as="xslt"`. `as="xslt"`. `as="xslt"`.
prerender 13 79 No 11 15 No 4.4 18 No 14 No 1.5
#
:::
html.elements.link.rel #
BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.
html.elements.a.rel #
BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.
html.elements.area.rel #
BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.
See also #
::: section-content
::: _attribution
© 2005–2023 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5
or later.
https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel{._attribution-link}
:::