Connecting the Web: Creating HTML Links

Learn the most important tag in HTML. Master the `<a>` tag and its `href`, `target`, and other attributes to build navigable websites.

Lesson ProgressStep 1 of 8
0 EXP

Hello! Links are the heart of the web, connecting billions of pages. Let's learn how to create them.

Anatomy of a Link

The link, or hyperlink, is created using the <a> tag. 'a' stands for "anchor". The content between the opening <a> and closing </a> tags is what the user sees and clicks on. This is called the link text.

<a>Clickable Link Text</a>

By itself, this tag does nothing. It's just a placeholder. It needs an attribute to tell it *where* to go.

System Check

What is the content between the <a> and </a> tags called?

Advanced Holo-Simulations

0 EXP

Log in to unlock these advanced training modules and test your skills.


Achievements

🔗
Link Master

Construct a valid <a> tag with an href attribute.

↗️
Navigation Expert

Correctly use target='_blank' to open a new tab.

Protocol
Protocol Whiz

Prove your mastery by creating a 'mailto:' or 'tel:' link.

Mission: Build a Navigation Set

Create a link to `https://google.com` that opens in a new tab and has the text 'Go to Google'. On a new line, add a second link that links to an email address `contact@example.com` with the text 'Email Us'.

A.D.A. Feedback:

> Awaiting input...

Challenge: Assemble the Link

Drag the parts to build a complete link that opens in a new tab. The attributes can be in any order after the tag.

href="https://todotutorial.com"
>Click Here</a>
<a
target="_blank"

Challenge: Complete the Syntax

Fill in the missing parts to create a link to a phone number.

<a=":+123456789">Call Us</a>

Consult A.D.A.

Unlock with Premium

Community Holo-Net

Peer Project Review

Submit your "Navigation Set" project for feedback from other Net-Runners.

Links: More Than Just Blue Text

The humble `<a>` tag is arguably the most important element in HTML. It's the "Hypertext" in Hypertext Markup Language. While its basic function is simple—go from page A to page B—mastering its nuances is key to building professional, accessible, and secure websites.

1. Accessibility: The "Click Here" Problem

Good link text is descriptive. It should make sense even when read out of context. Users with screen readers often navigate by tabbing from link to link. Imagine hearing "Click here... click here... read more..." —it's useless!

❌ Bad Practice

To learn about our new project, click here.

"Click here" gives no context to screen reader users.

✔️ Good Practice

Learn all about our new project and its 2025 goals.

The link text clearly describes the destination.

2. Security: `target="_blank"` and the `rel` Attribute

Using target="_blank" to open a new tab is convenient, but it creates a security vulnerability. The newly opened page gains partial control over the original page through the `window.opener` object. A malicious site could redirect your original page to a phishing site.

The fix is simple: **always** add rel="noopener noreferrer" when using target="_blank".

  • noopener: Prevents the new page from accessing `window.opener`.
  • noreferrer: Prevents the new page from knowing where it was linked from (improves privacy).
<a href="https://example.com" target="_blank" rel="noopener noreferrer">
  This link is secure
</a>

3. Anchor Links: Navigating the Same Page

Links don't have to go to other websites. They can jump to a different section of the *same page*. This is done by linking to an element's id using a hash (`#`).


<a href="#section-two">Jump to Section Two</a>

...


<h2 id="section-two">This is Section Two</h2>

This is perfect for creating a "Table of Contents" at the top of a long article.

Key Takeaway: An `<a>` tag is more than a simple command. It's a statement about **destination** (`href`), **context** (the link text), **user experience** (`target`), and **security** (`rel`). Use them thoughtfully.

HTML Links Glossary

`<a>` (Anchor Tag)
The fundamental HTML element used to create a hyperlink to another web page, a file, a location on the same page, or an email address.
`href` (Hypertext Reference)
The **most important attribute** of the `<a>` tag. Its value specifies the destination URL or path of the link.
`target`
Specifies where to open the linked document.
  • _self: (Default) Opens in the same frame or window.
  • _blank: Opens in a new tab or window.
  • _parent: Opens in the parent frame.
  • _top: Opens in the full body of the window.
`rel` (Relationship)
Specifies the relationship between the current document and the linked document. Crucial for security and SEO.
  • noopener: A security fix for `target="_blank"`.
  • noreferrer: Prevents sending referral information to the new page.
  • nofollow: Tells search engines not to "follow" this link (used for ads or untrusted content).
Absolute URL
A full web address, including the protocol (e.g., `https://`) and domain name. Used for linking to external websites.
Relative URL
A partial web address that does not include the domain. It's "relative" to the current page's location. Used for internal linking (e.g., `/about.html`).
Anchor Link
A link that jumps to a specific part of the same page, using a hash `#` followed by an element's `id`. Example: `href="#section-two"`.
`mailto:` Protocol
Used inside an `href` to create a link that opens the user's default email client. Example: `href="mailto:someone@example.com"`.
`tel:` Protocol
Used inside an `href` to create a link that initiates a phone call on mobile devices. Example: `href="tel:+1-555-123-4567"`.

Credibility and Trust

About the Author

Author's Avatar

Todotutorial Team

Passionate developers and educators making programming accessible to everyone.

This article was written and reviewed by our team of web development experts, who have years of experience teaching HTML and building robust and accessible web applications.

Verification and Updates

Last reviewed: October 2025.

We strive to keep our content accurate and up-to-date. This tutorial is based on the latest HTML5 specifications and is periodically reviewed to reflect industry best practices.

External Resources

Found an error or have a suggestion? Contact us!