Loading...

Using Links in HTML

Links are one of the most important building blocks of the web. They allow us to connect pages, access external sources, send emails, or enable downloads.

Creating a Basic Link

The simplest link is an <a> tag that uses the href attribute to specify the target URL. The link text goes between the opening and closing tag.

html

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

Opening Links in a New Tab

The target="_blank" attribute opens the link in a new browser tab or window. This is useful for external pages.

html

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

Internal Links

For internal links, the href points to a local file or path within the same website.

html

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

Email Links

An email link starts with the mailto: prefix followed by the email address.

html

<a href="mailto:[email protected]">Email us</a>

Links Styled as Buttons

An <a> element can be styled with CSS to look like a button. This is a common technique for call-to-action (CTA) buttons.

html

<a href="/contact.html" style="display: inline-block; padding: 10px 20px; background: #007bff; color: white; text-decoration: none; border-radius: 4px;">
  Contact Us
</a>

The rel Attribute

When opening a link in a new tab, it's recommended to include rel="noopener noreferrer" for improved browser security.

html

<a href="https://external-site.com" target="_blank" rel="noopener noreferrer">Secure External Link</a>

Summary

Links are simple yet powerful tools in HTML. They can be used for navigating to other pages, triggering downloads, linking to emails, or building site navigation. Attributes like href, target, and rel help you customize their behavior and appearance.

Track Your Progress 🚀

Learn more easily by tracking your progress completely for free.


Top tools

CodeHubBoardly NEWLinksy NEWChromo NEW

Select Language

Set theme

© 2025 ReadyTools. All rights reserved.