HTML Links

Links are defined with the <a> tag. The href attribute specifies the destination URL.

1) Basic Link


<a href="https://www.codingwithsonu.com">
  Visit Codingwithsonu
</a>

Visit Codingwithsonu

2) Absolute vs Relative Links


<!-- Absolute URL (full path) -->
<a href="https://www.google.com">Google</a>

<!-- Relative URL (relative to current site) -->
<a href="about-me.php">About Me</a>

Google (Absolute)

About Me (Relative)

3) Open in New Tab


<a href="https://youtube.com" 
   target="_blank">
   Visit YouTube
</a>

Visit YouTube (opens in new tab)

4) Link with Title


<a href="privacy-policy.php" 
   title="Read our Privacy Policy">
   Privacy Policy
</a>

Privacy Policy (hover to see title)

5) Email & Phone Links


<a href="mailto:codingwithsonu@gmail.com">
  Send Email
</a>

<a href="tel:+911234567890">
  Call Us
</a>

Send Email

Call Us

6) Internal Page Anchors


<a href="#section2">Go to Section 2</a>

<h2 id="section2">Section 2 Content</h2>

Jump to Section 2 (anchor)

Section 2 Content

Tip: Always use descriptive link text. Instead of “click here”, write “Read our Privacy Policy” for better accessibility and SEO.