HTML DOM Link rel attribute
Definition and Usage
rel attribute specifies the relationship between the current document and the linked documents.
grammar
Set the rel attribute:
linkObject.rel="relationship"
Back rel attributes:
linkObject.rel
Property values:
value | description |
---|---|
alternate | Alternative versions (such as the printed page, translated or mirror) document. |
stylesheet | External style sheet document. |
start | The first document in the collection. |
next | The next document in the collection. |
prev | On a document collection. |
contents | Contents of the document. |
index | Index document. |
glossary | Used in the document Glossary Glossary (explanation). |
copyright | Documents that contain copyright information. |
chapter | Chapter of the document. |
section | Section of the document. |
subsection | Section of the document. |
appendix | Appendix document. |
help | Help documentation. |
bookmark | Related documents. |
Browser Support
All major browsers support rel attribute
Note: Opera or Safari browser does not support the "search" value.
Note: IE, Safari, or Chrome browser does not support "sidebar".
Examples
Examples
It shows the relationship between the current document and the linked document between:
<! DOCTYPE html>
<Html>
<Head>
<Meta charset = "utf-8">
<Title> This tutorial (w3big.com) </ 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 ()"> link shows the relationship between the elements </ button>
</ Body>
</ Html>
<Html>
<Head>
<Meta charset = "utf-8">
<Title> This tutorial (w3big.com) </ 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 ()"> link shows the relationship between the elements </ button>
</ Body>
</ Html>
try it"
Link Objects