🔗 HTML Links (Anchor Tag)
Last Updated: 01 Nov 2025
Links (also called Hyperlinks) connect one webpage to another — within the same website or to external sites. They are created using the <a> tag, also known as the anchor tag.
Syntax
<a href="URL">Link Text</a>
- href → stands for Hypertext Reference (the link address) or use #idName for jump to a specific section
- Link Text → the text users click to open the link
Example
<a href="https://tukkalearn.vercel.app/">Visit Tukka Learn</a>
<a href="#about">About Us</a>
Types of Links
Attributes of Anchor Tag
- href → Specifies the URL of the linked document
- title → Shows tooltip when you hover over the link
- target="_blank" → Opens the link in a new tab
- download → Downloads the linked file
- rel="noopener noreferrer" → Improves security for external links
Example of all attributes
<body>
<h1>My Website</h1>
<h2>Internal Links</h2>
<a href="about.html">About Page</a><br />
<a href="contact.html">Contact Page</a>
<h2>External Links</h2>
<a href="https://tukkalearn.vercel.app/" title="Tukka Learn">
Visit Tukka Learn
</a>
<a
href="https://tukkalearn.vercel.app/"
target="_blank"
rel="noopener noreferrer"
>
Visit Tukka Learn
</a>
<h2 id="top">Top Section</h2>
<a href="#bottom">Go to Bottom</a>
<h2 id="bottom">Bottom Section</h2>
<a href="#top">Back to Top</a>
<a href="file.pdf" download>Download File</a>
</body>
🗣 Hinglish Recap: <a> tag = bridge between pages. href likhna zaroori hai — warna link ka “destination” nahi milega!
