The rel Attribute

This attribute can be used on <a> and <link> tags to define the relationship that the file linked to has with this web page (the rev attribute serves the same purpose in reverse of defining what this page is relative to the other file).The file can have more than one relationship in which case multiple values can be specified in the attribute separated by a space. The values are not case sensitive which means that the values have the same meaning whether the letters are in upper or lower case.

The following are valid values that can be used in the rel attribute:

used with a second value this Identifies this link as a substitute version of that type.
Refers to an external style sheet.
Refers to the first document in a collection of documents.
Refers to the next document in a linear sequence of documents.
Refers to the previous document in an ordered series of documents.
Identifies the referenced file as a table of contents.
Identifies the referenced file as an index for the current document.
Identifies the referenced file as a glossary of terms that pertain to the current document.
Refers to a copyright statement for the current document.
Identifies the referenced file as a chapter in a collection of documents.
Identifies the referenced file as a section in a collection of documents.
Identifies the referenced file as a subsection in a collection of documents.
Identifies the referenced file as an appendix in a collection of documents.
Identifies the referenced file as offering help.
Refers to a bookmark.

Note that these are the only values for the rel attribute that are defined within the standard. The standard does allow you to define your own values for use in the rel (and rev) attributes provided that you define their meaning in a file referenced by the profile attribute on the <head> tag.

Any use of values in the attribute that are not in the above list or defined via a profile are, strictly speaking, invalid HTML. Browsers are unlikely to apply this particular part of the standards though and s as long as the values that you use in the attribute do not contain any characters apart from letters you should have no issues with using your own (or someone else's) values in the rel attribute even without applying a profile to define what your new value is supposed to mean.

One example of a non-standard value for this attribute which can be successfully used for its intended purpose without needing to define it first is nofollow which several popular search engines expect to be used to identify links that were added to the page by someone other than the site owner and the site owner does not endorse the link.

Another example of using your own values with the rel attribute is where you are identifying links to which special JavaScript processing is to be applied when JavaScript is enabled in the browser - for example if you have thumbnail images defined as links to larger copies of the images you may specify a particular rel value on those links so that a JavaScript lightbox script can load those images into the current page rather than loading a new page to display the image. Should you need to provide more than one value to JavaScript then these should be supplied as a space separated list both in order to comply with the HTML standard as closely as possible and also because it will make extracting the values from the attribute easier in your JavaScript.


This article written by Stephen Chapman, Felgall Pty Ltd.

go to top

FaceBook Follow
Twitter Follow