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, the HTML Living Standard, and the freely-editable existing-rel-values page in the microformats wiki, as suggested 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) 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.