w3resource

HTML rel attribute

rel

The purpose of the HTML rel attribute is to define a relationship with another document specified by the value of the href attribute of the associated element.

Pictorial presentation

pictorial exaplanation of html rel attribute

Supported elements

HTML rel attribute supports a and link elements.

Syntax

<ElementName rel="value" >.....</ElementName>

Where ElementName is any supported element.

Type of value

Link type.

Value

Value(Link types) Description
alternate May be a printed page, the same document in a different language or mirror document which is an alternate version of the current document.
stylesheet Refers to an external style sheet for the document.
start Refers to the first document in a collection of documents.
next Refers to the next document in a series of documents.
prev Refers to the previous document in a series of documents.
contents Refer to the document which is a table of contents.
index Refers to the document which is the index for the current document.
glossary Refers to the document which contains an explanation of words used in the current document.
copyright Refers to the copyright information of the current document.
chapter Refers to a chapter of the current document.
section Refers to a section of the current document.
subsection Refers to a subsection of the current document.
appendix Refers to an appendix for the current document.
help Refers to a help document.
bookmark Refers to a related document.

Supported doctypes

HTML 4.01 strict, HTML 4.01 transitional, HTML 4.01 frameset.

Example of HTML rel attribute with link element

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Example of HTML rel attribute with link element</title>
<link rel='stylesheet' href='test.css' type='text/css'> 
</head>
<body> 
<p>This is an example rel attribute.</p>
</body>
</html>

Example of HTML rel attribute with a element

 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Example of HTML rel attribute with a element</title>
</head>
<body>
<p><a rel='index' href='https://www.w3resource.com/index.php'>w3resource tutorials</a></p>
</body>
</html>

Previous: HTML readonly attribute
Next: HTML rev attribute

Test your Programming skills with w3resource's quiz.



Follow us on Facebook and Twitter for latest update.