Easy Tutorial
❮ Dom Obj Textarea Event Onvolumechange ❯

Link rel Attribute


Definition and Usage

The rel attribute specifies the relationship between the current document and the linked document.

Syntax

Setting the rel attribute:

Returning the rel attribute:

Attribute Values:

Value Description
alternate An alternative version of the document (e.g., print page, translation, or mirror).
stylesheet An external style sheet for the document.
start The first document in a collection.
next The next document in a collection.
prev The previous document in a collection.
contents A table of contents for the document.
index An index for the document.
glossary A glossary of terms used in the document.
copyright A document containing copyright information.
chapter A chapter of the document.
section A section of the document.
subsection A subsection of the document.
appendix An appendix of the document.
help A help document.
bookmark A related document.

Browser Support

All major browsers support the rel attribute.

Note: The "search" value is not supported by Opera or Safari browsers.

Note: The "sidebar" value is not supported by IE, Safari, or Chrome browsers.


Example

Display the relationship between the current document and the linked document:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>tutorialpro.org(tutorialpro.org)</title>
<link id="link1" rel="stylesheet" type="text/css" href="style1.css">
<script>
function displayResult(){
    var x=document.getElementById("link1").rel;
    alert(x);
}
</script>
</head>
<body>

<button type="button" onclick="displayResult()">Display the relationship of the link element</button>

</body>
</html>

❮ Dom Obj Textarea Event Onvolumechange ❯