Open In App

What is use of rel Attribute in HTML ?

The “rel” attribute in HTML is used to define the relationship between the current document and the linked document or resource specified by the <a> (anchor) tag or the <link> tag. It provides additional context or metadata about the linked resource, aiding in navigation, search engine optimization, and accessibility.

Syntax

<a href="URL" rel="relationship_type">Link Text</a>
<link rel="relationship_type" href="stylesheet.css">
Key Point Description
Relationship Type The value of the “rel” attribute specifies the type of relationship between the current document and the linked resource.
Common Values Common values for the “rel” attribute include “stylesheet”, “icon”, “nofollow”, “canonical”, “prev”, “next”, and “alternate”.
Link Types The “rel” attribute is commonly used in anchor tags <a> and link tags <link> to specify relationships between documents, stylesheets, icons, and alternate versions of content.
SEO and Accessibility Properly defining relationships with the “rel” attribute can improve search engine rankings, enhance accessibility, and provide better user experience.

Features

<a href="https://example.com/page2" rel="next">Next Page</a>
<link rel="stylesheet" href="styles.css">
<link rel="canonical" href="https://example.com/page">
Article Tags :