Link Types and Relationships
You'll learn how to use the rel attribute to define the relationship and behavior between your page and linked resources.
What is the rel Attribute?
When you create a hyperlink with <a href="...">, you're connecting your page to another resource. The rel (relationship) attribute tells the browser what kind of connection this is and how to treat it.
Think of rel like labeling your relationships on social media: "friend," "colleague," "family." Similarly, links need labels so browsers, search engines, and accessibility tools understand the connection's nature.
Common rel Values
nofollow
<a href="https://example.com" rel="nofollow">User Comment Link</a>
Tells search engines: "Don't pass ranking credit to this link." Use for user-generated content or untrusted links.
noopener
<a href="https://example.com" target="_blank" rel="noopener">External Site</a>
Security protection when opening links in new tabs. Prevents the new page from accessing your original page's window object.
noreferrer
<a href="https://example.com" rel="noreferrer">Private Link</a>
Hides where the click came from. The destination won't know your page sent the visitor.
Combining Multiple Values
<a href="https://ads.example.com" rel="nofollow noopener noreferrer">Ad Link</a>
You can use multiple values separated by spaces.
Why This Matters
These attributes control security, privacy, and how search engines interpret your links. Using rel="noopener" with target="_blank" is a security best practice you should form habitually.
Key Takeaway: The rel attribute defines link relationships—use nofollow for untrusted content, noopener for security with new tabs, and noreferrer for privacy.