HTML Tags

HTML <a> Tag

The <a> tag, also known as the anchor tag, is used to create hyperlinks in HTML.
It allows users to navigate between web pages, jump to specific sections, download files, or even send emails using mailto: links.
It is one of the most important elements for web navigation and interconnectivity.

Syntax

<a href="URL">Link Text</a>

Attributes

AttributeDescription
hrefSpecifies the destination URL or resource to link to.
targetDefines where to open the linked document (_self, _blank, _parent, _top).
titleDisplays additional information when the user hovers over the link.
downloadInstructs the browser to download the linked file instead of navigating to it.
relSpecifies the relationship between the current document and the linked document (e.g., nofollow, noopener, noreferrer).
idUnique identifier for the link.
classCSS class for styling the link.
styleInline CSS styling for the link.

Example

<!DOCTYPE html>
<html>
<head>
  <title>Anchor Tag Example</title>
  <style>
    a {
      color: #29AB87;
      text-decoration: none;
      font-weight: bold;
    }
    a:hover {
      color: #1c7a63;
      text-decoration: underline;
    }
  </style>
</head>
<body>
  <h1>HTML &lt;a&gt; Tag Example</h1>

  <p>
    Visit our official website:
    <a href="https://html5andcss3.org" target="_blank" title="Visit HTML5 and CSS3 Official Site">
      HTML5 and CSS3
    </a>
  </p>

  <p>
    Download a sample PDF file:
    <a href="/samples/sample.pdf" download="sample.pdf">Download PDF</a>
  </p>

  <p>
    Send us an email:
    <a href="mailto:info@html5andcss3.org">info@html5andcss3.org</a>
  </p>

  <p>
    Jump to a section on this page:
    <a href="#about">Go to About Section</a>
  </p>

  <h2 id="about">About Section</h2>
  <p>This section explains the working of the anchor tag in HTML.</p>
</body>
</html>

Output

Browser Output

Use our TryIt Editor to see the output.

Browser Support

Chrome
Chrome
Firefox
Firefox
Edge
Edge
Safari
Safari
Opera
Opera
IE
IE9+
✅Yes✅Yes✅Yes✅Yes✅Yes✅Yes

The links appear as clickable text, styled according to your CSS.
Hover effects, file download, and email actions work as expected.

Notes

  • Always use target="_blank" carefully — add rel="noopener noreferrer" for security.
  • The <a> tag can link to internal elements using IDs (e.g., href="#section").
  • You can turn any element (like <img> or <button>) into a link by wrapping it with <a>.
  • Use the download attribute for files you want the user to save instead of opening.
  • mailto will only work on the device which has default mail client has been configured.

Conclusion

The <a> tag enables hyperlinking and navigation, connecting web pages, files, and resources seamlessly.
It is the backbone of web navigation, making content interactive and interconnected.

Sign In Form

User your email and password to singn in

Don’t have an account, signup here : 

HTML5 & CSS3

Tools and Tutorials

Want a Website

Want a website for your business ?

Please fill out the details below, so we can reach out to you.

Registration Form

Signup to track your record and much more.

We have sent you an email with a registration link. Please click the link to verify your email address, or enter the 6-digit OTP provided in the email.

Didn't receive the OTP. Regenerate OTP Resend