HTML Tutorial


html link tag



HTML Links – Complete Documentation

Introduction

Hyperlinks (links) are the foundation of web navigation. They allow users to jump between web pages, access resources, or trigger downloads. The <a> element defines a hyperlink in HTML. Understanding links is critical for creating functional and accessible websites.

Basic Syntax

The basic structure of an HTML link:

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

The href attribute specifies the URL of the page or resource to link to.

Types of Links

  • External Links: Navigate to another website (absolute URL).
  • Internal Links: Navigate to a different page within the same website (relative URL).
  • Anchor Links: Jump to a specific section on the same page.
  • Download Links: Allow users to download files.
  • Email Links: Open the user’s email client using mailto:.
  • Telephone Links: Open the phone dialer using tel:.

Attributes

Attribute Description
href Specifies the destination URL of the link.
target Specifies where to open the link. E.g., _blank opens in a new tab.
rel Defines relationship between the current and linked document (e.g., noopener for security).
download Instructs the browser to download the linked resource.

Examples

1. External Link in New Tab:

<a href="https://www.example.com" target="_blank" rel="noopener noreferrer">Visit Example</a>
        

2. Internal Page Link:

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

3. Anchor Link:

<a href="#contact">Go to Contact Section</a>
...
<h2 id="contact">Contact Us</h2>
        

4. Email and Phone Links:

<a href="mailto:info@example.com">Send Email</a>
<a href="tel:+911234567890">Call Us</a>
        

Best Practices

  • Use descriptive anchor text for clarity and accessibility.
  • Always include rel="noopener noreferrer" when using target="_blank".
  • Check links regularly to avoid broken links.
  • Internal linking improves navigation and SEO.

Summary

HTML links (<a>) are essential for web navigation. Understanding attributes, link types, and best practices ensures your website is functional, accessible, and SEO-friendly.


🌟 Enjoyed Learning with Us?

Help others discover Technorank Learning by sharing your honest experience.
Your support inspires us to keep building!

Leave a Google Review