<link/> Tag Attributes

Attributes of the <link/> tag
global attributes In addition to the local attributes of the <link> tag below, any of the common HTML attributes can also be coded.
The itemprop attribute is required when the <link/> tag is used where flow content or phrasing content is expected.
href

URL of the referenced document or any other URI reference (or IRI reference depending on the encoding) such as a mailto: link

Use percent escape codes as explained in the URL Encoding Tutorial for any special characters in the URI reference.

If the value of the href attribute resolves to an HTTP URI, it may contain any of the following components:

  1. protocol scheme, typically http: or else https:
  2. username, followed by an "@"
  3. host name or IP address
  4. port number, which defaults to 80 for the http scheme and 443 for the https scheme
  5. absolute or relative path
  6. search query, indicated by "?"
  7. fragment identifier, indicated by "#"

If the protocol scheme, username, host name/IP address and port number are omitted the default is the current host - the same server as the base of the current document. If the path starts with a slash /..., it is an absolute path from the document root directory (AKA "web root") on the server. A relative path will be resolved relative to the base of the current document. A URI with a "#" but no fragment identifier points to the top of the document.

hreflang indicates the language of the referenced document
media

The value of the media attribute is a media type or a comma-separated list of media types indicating an "or" relationship. Some browsers may also recognize expressions with media queries, such as handheld and (min-width:200px).

Continuous media types

  • media="braille"
  • media="screeen"
  • media="speech"
  • media="tty"

Hybrid (continuous or paged) media types

  • media="all" (default)
  • media="handheld"
  • media="tv"

Paged media types

  • media="embossed"
  • media="print"
  • media="projection"

These media query values can also be used in the media attribute of the <style> tag and in the @media and @import CSS Rules.

rel="acquaintance"
rel="alternate"
rel="alternate stylesheet"
rel="apple-touch-icon"
rel="apple-touch-startup-image"
rel="archives"
rel="author"
rel="appendix"
rel="bookmark"
rel="chapter"
rel="child"
rel="co-resident"
rel="co-worker"
rel="colleague"
rel="contact"
rel="contents" (use rel="index" instead)
rel="copyright"
rel="crush"
rel="date"
rel="external"
rel="feed"
rel="feed alternate"
rel="first"
rel="friend"
rel="glossary"
rel="help"
rel="icon"
rel="index"
rel="kin"
rel="last"
rel="license"
rel="me"
rel="met"
rel="muse"
rel="neighbor"
rel="next"
rel="nofollow"
rel="noreferrer"
rel="parent"
rel="pingback"
rel="prefetch"
rel="prev"
rel="search"
rel="section"
rel="shortcut icon" (use rel="icon" instead)
rel="sibling"
rel="sidebar"
rel="spouse"
rel="start" (use rel="first" instead)
rel="stylesheet"
rel="subsection"
rel="sweetheart"
rel="tag"
rel="up"

The rel attribute is an enumerated attribute that specifies the purpose of the link. It may contain a single keyword, or a list of rel attribute keyword values separated by spaces.

rel attribute values for hypertext links
acquaintance
(from XFN rel= extensions) The person described by the document containing the link considers the person described by the referenced document to be an acquaintance.
alternate
The referenced document is an alternate representation of the document containing the link. This should only be used when the referenced document has content similar to the current document but published in an alternate form, such as a syndicated feed for a list of blog posts (see rel="feed alternate"). If the document has been translated into other languages, the language of the translation should be indicated in an hreflang attribute (not the lang attribute).
apple-touch-icon
The apple-touch-icon is a 57-pixel by 57-pixel PNG image used when bookmarking a web site or web page on an iPhone, iPad or iPod Touch device
apple-touch-startup-image
The apple-touch-startup-image is an image displayed while an offline web application is being launched on an iPhone, iPad or iPod Touch device.
archives
New The referenced document is a list of previously created versions of related documents, such as the archives of a blog.
author
The link references a resource about the author of the document. For search engine optimization, Google recommends using a link to the author's Google Profile or a page about the author on the same domain as the link. It could also be a link to another type of resource, such as a mailto: link to the email address of the author. See the rel="author" Tutorial.
child
(from XFN rel= extensions) The person described by the referenced document is a child of the person described by the document containing the link.
co-resident
(from XFN rel= extensions) The person described by the referenced document lives in the same place as the person described by the document containing the link.
co-worker
(from XFN rel= extensions) The person described by the referenced document works for the same company or organization as the person described by the document containing the link.
colleague
(from XFN rel= extensions) The person described by the referenced document works in the same field of employment as the person described by the document containing the link.
contact
(from XFN rel= extensions) The person described by the referenced document is someone who might be contacted by the person described by the document containing the link.
crush
(from XFN rel= extensions) The person described by the document containing the link has a crush on the person described by the referenced document.
date
(from XFN rel= extensions) The person described by the document containing the link has been dating the person described by the referenced document.
feed
New For feed autodiscovery, links to a syndicated feed channel for the document or the web site. Do not use or include rel="alternate" unless the current document and the feed are alternate forms of the same content; if the current entry is a subset of the feed, such as a single blog post, use rel="feed" without "alternate" in the attribute.
feed alternate
New Used when the referenced document is the syndicated feed for the current content, such as the feed for a list of blog posts in an HTML page (but not a single blog post, which would be an <entry> or <item> in the feed rather than the entire feed).
first
New Links to the first document in a series of articles.
friend
(from XFN rel= extensions) The person described by the document containing the link considers the person described by the referenced document to be a friend.
help
Links to a document that provides helpful information related to the content of the document containing the link (not a general help page).
index
Links to a table of contents or index document that includes the document containing the link as well as others in the same collection of documents.
kin
(from XFN rel= extensions) The person described by the document containing the link and the one described by the referenced document are members of the same extended family.
last
New Links to the last document in a series of articles.
license
New Links to a document that describes the copyright license that applies to the document(s) in which the link to the license page appears.
me
(from XFN rel= extensions) The person described by the referenced document is the same person as the one described by the document containing the link. They are two pages describing the same person.
met
(from XFN rel= extensions) The person described by the document containing the link claims to have met the person described by the referenced document.
muse
(from XFN rel= extensions) The person described by the referenced document provides inspiration to the person described by the document containing the link.
neighbor
(from XFN rel= extensions) The person described by the referenced document lives near the person represented by the document containing the link.
next
In a series of documents, the referenced document is the next one in sequence following the document containing the link.
parent
(from XFN rel= extensions) The person described by the referenced document is a parent of the person described by the document containing the link.
prev
In a series of documents, the referenced document is the previous one in sequence prior to the document containing the link.
New Links to a document that provides information that can be used by search engines. This could be an XML file conforming to the OpenSearch Description Document specification.
sibling
(from XFN rel= extensions) For a pair or siblings; the person described by the referenced document is a brother or sister of the person described by the document containing the link.
sidebar
New Indicates that the referenced document should be loaded into the web browser's sidebar if the link is activated by the user.
spouse
(from XFN rel= extensions) The person described by the referenced document is the husband or wife of the person represented by the document containing the link.
sweetheart
(from XFN rel= extensions) The person described by the document containing the link considers the person described by the referenced document to be their sweetheart.
tag
New Specifies a URI that is a "tag", which describes the subject of a page. The tag may be a URL, which leads to a web-accessible page, or just a standalone identifier.
up
New Links to the document at the next higher level in a tree hierarchy. The value up may be specified more than once: rel="up" points to the parent document, rel="up up" points to the grandparent, and so forth.
rel attribute values for links to external resources
icon
New Points to a "favorites" icon, often named favicon.ico, that can be used to represent the document containing the link. A favorites icon is a color bitmapped image, usually square-shaped (ex: 16 by 16 pixels or "32x32"), that can be displayed in the browser address bar or in the favorites or bookmarks. Since the values of the rel attribute that are separated by spaces are distinct values, the icon keyword is sufficient for this purpose; using rel="shortcut icon" is redundant because the keyword "shortcut" has no meaning.
pingback
New Used in a link that provides the URL of the resource to handle a pingback for the document containing the link.
prefetch
New Indicates that the referenced document should be automatically preloaded into cache.
stylesheet
References a document that provides styles or templates for the document containing the link. The default for the type attribute is type="text/css".
alternate stylesheet
References a user-selectable alternate style sheet. The title attribute is also required. The default for the type attribute is type="text/css".
sizes Used only with rel="icon" for a shortcut/favorites icon, the value provides one or more pairs of width and height values, specified as positive integers and joined by an "x" (width "by" height) or the keyword "any" separated by spaces.
title Although title is one of the common attributes, which can be coded on any HTML element, it performs somewhat differently when coded on the link tag. The title may appear as a tool tip when the mouse hovers over the link. For rel="alternate stylesheet" links, the values of the title attribute identify groups of alternate style sheets that may optionally be used to view the document. In addition, the value of the title attribute of the link tag is not inherited from its ancestors. Line breaks in the title attribute are preserved. Therefore, the title should not be split across multiple lines.
type