Skip to main content

Beginner-Friendly Topic

Take your time - it's perfectly normal to re-read this topic 2-3 times. Try the interactive code editor below to run code yourself. Use the Q&A section to check your understanding before moving on.You've got this!

Lesson 3 of 9

Link Attributes & Security

The <a> tag supports many attributes beyond href that control how links behave, affect security, and impact SEO. Understanding attributes like target, rel, download, and title is essential for creating professional, secure, and accessible links.

15 minBy Priygop Editorial TeamUpdated 2026Peer Reviewed & Verified

Key Link Attributes

Beyond href, the <a> tag supports several important attributes:

target β€” Controls WHERE the link opens:
β€’ _self (default) β€” Same tab
β€’ _blank β€” New tab

rel β€” Relationship between pages:
β€’ noopener β€” Prevents window.opener access (SECURITY)
β€’ noreferrer β€” Prevents sending referrer URL
β€’ nofollow β€” No SEO value passed
β€’ sponsored β€” Paid links
β€’ ugc β€” User-generated content

SECURITY RULE: Always use rel="noopener noreferrer" with target="_blank".

Diagram
Loading diagram…

Always add rel=noopener noreferrer when using target=_blank

Secure Links Example

Secure Links Example
<!DOCTYPE html>
<html>
<body>
  <h1>Link Attributes Demo</h1>
  <p><a href="https://google.com" target="_blank" rel="noopener noreferrer" title="Opens Google in a new tab">Visit Google (secure)</a></p>
  <p><a href="/files/guide.pdf" download="html-guide-2025.pdf">Download HTML Guide (PDF)</a></p>
  <p><a href="https://advertiser.com" rel="nofollow sponsored" target="_blank">Sponsored Link (nofollow)</a></p>
</body>
</html>

Warning

Never use rel='nofollow' on your own internal links β€” it wastes your site's SEO value. Use it only for external links you don't endorse.

Quick Quiz

Hands-on Practice Tools for this Course

Test what you learn using these free in-browser developer utilities (no signup required).

All 40+ Tools

Topics in This Module

0/9 done