Anchor Tag (Links)

Definition

The anchor tag (<a>) is used to create hyperlinks that connect one webpage to another page, section, file, or website.

Basic Syntax

<a href="URL">Link Text</a>

Types of Links in HTML

External Link

<a href="https://www.google.com">Go to Google</a>

Internal Link

<a href="about.html">About Us</a>

Bookmark Link

<a href="#contact">Go to Contact</a>

<h2 id="contact">Contact Section</h2>

Email Link

<a href="mailto:info@example.com">Send Email</a>

Phone Link

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

Open Link in New Tab

<a href="https://example.com" target="_blank">Open in new tab</a>

Anchor Tag Attributes

AttributeUse
hrefDestination URL
targetOpen location
titleTooltip
downloadDownload file