Linking Things Up in HTML

Create hyperlinks using the anchor tag. Link to other pages, sections, emails, and external sites. Build navigation.

Links are what make the web a web — they connect pages together. The <a> (anchor) tag creates clickable links.

Basic Link

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

The href attribute is the destination. The text between the tags is what users click.

Types of Links

External Links

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

Internal Links (Other Pages)

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

Jump Links (Same Page)

<a href="#section2">Jump to Section 2</a>
...
<h2 id="section2">Section 2</h2>

Email Links

<a href="mailto:hello@example.com">Email Us</a>

Phone Links

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

Opening in a New Tab

<a href="https://google.com" target="_blank" rel="noopener noreferrer">
  Open in New Tab
</a>

Always add rel="noopener noreferrer" with target="_blank" for security.

Links with Images

<a href="/home">
  <img src="logo.png" alt="Home">
</a>

You can wrap any element in a link — images, divs, even entire cards!