rel
rel Attribute
The rel
attribute describes the connection between a linked resource and the current page. It is commonly used with <link>
, <a>
, <area>
, and <form>
elements.
Syntax
<tagname rel="nofollow | noopener | noreferrer | stylesheet | icon | canonical | dns-prefetch | external | author | help | license | prev | next | bookmark | search | alternate | tag" />
Example
- Link with
rel
attribute
<h1>The a rel attribute</h1>
<p><a rel="nofollow" href="https://institute.qarpeo.com/">https://institute.qarpeo.com</a></p>
Area
- An
image
map, with a clickable area:
<img src ="img.jpg" width="145" height="126" alt="Laptop"
usemap="#planetmap">
<map name="planetmap">
<area shape="rect" coords="0,0,82,126" href="sun.htm" alt="Sun">
<area shape="circle" coords="90,58,3" href="mercur.htm" alt="Mercury">
<area shape="circle" coords="124,58,8" href="venus.htm" alt="Venus">
</map>
Applies to
The rel
attribute can be used on the following elements:
Key Points
- Purpose: Defines the relationship between the current document and a linked resource.
- Usage: The applicable values depend on the element.
- Values: Should be unique and separated by spaces. Common values include:
Important Values
stylesheet
: Links to an external CSS file.canonical
: Marks the preferred URL for the page.nofollow
: Tells search engines not to follow the link.noopener
,noreferrer
: Enhances security when opening links in new tabs or windows by mitigating risks.
Conclusion
The rel
attribute in HTML defines the relationship between the current document and a linked resource, often used in elements like <a>
, <link>
, <area>
, and <form>
. It supports various values such as stylesheet
, nofollow
, noopener
, and canonical
, each serving different purposes like linking to a CSS file, instructing search engines, or enhancing security. Correct usage of the rel
attribute improves navigation, SEO, and security.
popover
The popover attribute is not part of standard HTML. Instead, you can utilize libraries or develop custom solutions to implement popover or tooltip features in web development.
shape
The `shape` attribute defines the shape of clickable areas in an image map, determining how the area responds to user interactions.