HTML Links

What are HTML Links?

HTML links are hyperlinks. You can click on a link and jump to another document. Links are created using the <a> tag.

Basic Link

The href attribute specifies the destination of the link:

Example
<a href="https://www.example.com">Visit Example</a>

Link Target

Use the target attribute to specify where to open the linked document:

Example
<a href="https://www.example.com" target="_blank">Open in new tab</a>
<a href="page.html" target="_self">Open in same window</a>

Link Types

External Links

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

Internal Links

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

Email Links

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

Phone Links

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

Anchor Links

Links can point to specific sections on the same page:

Example
<a href="#section1">Go to Section 1</a>
<h2 id="section1">Section 1</h2>

Link Styling

Links have different states that can be styled with CSS: