![HTML Tutorial](/html/images/html-mini-logo.jpg)
- HTML Tutorial
- HTML - Home
- HTML - Introduction
- HTML - Editors
- HTML - Basic Tags
- HTML - Elements
- HTML - Attributes
- HTML - Headings
- HTML - Paragraphs
- HTML - Fonts
- HTML - Blocks
- HTML - Style Sheet
- HTML - Formatting
- HTML - Quotations
- HTML - Comments
- HTML - Colors
- HTML - Images
- HTML - Image Map
- HTML - Iframes
- HTML - Phrase Elements
- HTML - Meta Tags
- HTML - Classes
- HTML - IDs
- HTML - Backgrounds
- HTML Tables
- HTML - Tables
- HTML - Headers & Caption
- HTML - Table Styling
- HTML - Table Colgroup
- HTML - Nested Tables
- HTML Lists
- HTML - Lists
- HTML - Unordered Lists
- HTML - Ordered Lists
- HTML - Definition Lists
- HTML Links
- HTML - Text Links
- HTML - Image Links
- HTML - Email Links
- HTML Color Names & Values
- HTML - Color Names
- HTML - RGB
- HTML - HEX
- HTML - HSL
- HTML Forms
- HTML - Forms
- HTML - Form Attributes
- HTML - Form Control
- HTML - Input Attributes
- HTML Media
- HTML - Video Element
- HTML - Audio Element
- HTML - Embed Multimedia
- HTML Header
- HTML - Head Element
- HTML - Adding Favicon
- HTML - Javascript
- HTML Layouts
- HTML - Layouts
- HTML - Layout Elements
- HTML - Layout using CSS
- HTML - Responsiveness
- HTML - Symbols
- HTML - Emojis
- HTML - Style Guide
- HTML Graphics
- HTML - SVG
- HTML - Canvas
- HTML APIs
- HTML - Geolocation API
- HTML - Drag & Drop API
- HTML - Web Workers API
- HTML - WebSocket
- HTML - Web Storage
- HTML - Server Sent Events
- HTML Miscellaneous
- HTML - MathML
- HTML - Microdata
- HTML - IndexedDB
- HTML - Web Messaging
- HTML - Web CORS
- HTML - Web RTC
- HTML Demo
- HTML - Audio Player
- HTML - Video Player
- HTML - Web slide Desk
- HTML Tools
- HTML - Velocity Draw
- HTML - QR Code
- HTML - Modernizer
- HTML - Validation
- HTML - Color Picker
- HTML References
- HTML - Cheat Sheet
- HTML - Tags Reference
- HTML - Attributes Reference
- HTML - Events Reference
- HTML - Fonts Reference
- HTML - ASCII Codes
- ASCII Table Lookup
- HTML - Color Names
- HTML - Entities
- MIME Media Types
- HTML - URL Encoding
- Language ISO Codes
- HTML - Character Encodings
- HTML - Deprecated Tags
- HTML Resources
- HTML - Quick Guide
- HTML - Useful Resources
- HTML - Color Code Builder
- HTML - Online Editor
HTML - rel Attribute
HTML rel attribute specifies the relationship between the current document and the linked document or resource.
This attribute will be used only when the href attribute is present in the syntax.
Syntax
<link rel="value">
Attribute value
- alternate: It specifies the alternative link of the document (i.e. print page, translated or mirror).
- author: It defines author of the link.
- dns-prefetch: It specifies that the browser should pre-emptively perform DNS resolution for the target resource’s origin.
- help: It specifies a link to a help document. Example: <link rel="help" href="/help/">
- icon: It imports an icon in a given document.
- license: It specifies a link to copyright information for the document.
- next: It provides the link of next document is series.
- pingback: It gives the address of the pingback server.
- prefetch: It specifies that the target should be cached.
- preconnect: It specifies the target should be preemptively to the origin resource.
- preload: It specifies that the browser must preemptively fetch and cache.
- prerender: It specifies that the browser should load.
- prev: It specifies the previous document in a selection.
- search: It specifies the search tool for the document.
- stylesheet: It imports a style sheet.
Applies on
Below-listed elements allow the use of the HTML rel attribute.
Element | Description |
---|---|
<a> | HTML <a> tag defines a hyperlink. It is used to link from one page to another. |
<area> | HTML <area> tag specifies the areas of the image, mapping that can be clicked on or are active areas that are linked to by hyperlinks. |
<link> | HTML <link> tag specifies relationship between the current document and an external resource. |
<form> | HTML <form> tag is used to collect user input on a website throuugh a form. |
Examples of HTML rel attribute
Below examples will illustrate the HTML rel attribute, where and how we should use this attribute!
Import external style sheet using rel attribute in link tag
The below rel.html displays the text with the css applied through rel.css
rel.html
<!DOCTYPE html> <html> <head> <title>HTML rel Attribute</title> <link rel="stylesheet" type="text/css" href="rel.css"> </head> <body> <h3>HTML rel attribute</h3> <h1>tutorials <span>point</span></h1> <p>easy to learn!</p> </body> </html>
rel.css
This is external CSS file −
h3{ background-color: yellow; font-style: italic; } h1{ color:green; } span{ color:black; } p{ color:green; }
Using rel attribute in 'area' tag
The below code displays an image map. Upon clicking it, another image gets displayed.
<!DOCTYPE html> <html> <head> <title>HTML area rel attribute</title> </head> <body> <h1>HTML area rel attribute</h1> <p>Click on the below image to see another image!</p> <img src= "/html/images/test.png" height="130" alt="earth" usemap="#earthmap"> <map name="earthmap"> <area shape="rect" coords="0,0,60,100" alt="earth" href= "/images/html.gif" rel="alternate"> </map> </body> </html>
Using rel attribute as icon in 'a' tag
The output window displays a hyperlink which upon clicking displays tutorialspoint logo.
<!DOCTYPE html> <html> <head> <title>HTML rel Attribute in a tag</title> </head> <body> <h3>HTML rel attribute in "a" tag</h3> <a rel="icon" href="/images/logo.png?v2"> tutorialspoint logo </a> </body> </html>
Stop browser from sending HTTP referrer header on form submission
Output window displays a form and upon submission, browser won't send http referrer header.
<!DOCTYPE html> <html> <head> <title>HTML Form rel Attribute</title> </head> <body> <h1>HTML Form rel Attribute</h1> <form rel="noreferrer" action="/action_page.php"> <input type="text" name="firstname" placeholder="Enter First Name"><br><br> <input type="text" name="lastname" placeholder="Enter Last Name"><br><br> <input type="submit" value="SUBMIT" class="btn"> </form> </body> </html>
Supported Browsers
Attribute | ![]() |
![]() |
![]() |
![]() |
![]() |
---|---|---|---|---|---|
rel | Yes | Yes | Yes | Yes | Yes |
html_attributes_reference.htm
Advertisements