The <a> tag

The <a> tag creates a hyperlink to another document, a page section, a file, an email address, or any other URL.

Syntax

<a href="https://example.com">link text</a>

Attributes

href The URL the link points to. Can be absolute, relative, an anchor (#id), or mailto:/tel:.
target "_blank" opens the link in a new tab. Pair target="_blank" with rel="noopener".
rel Relationship to the target document: noopener, noreferrer, nofollow, etc.
download Hints the browser to download the file instead of navigating; you can also specify a filename as its value.

Example

<a href="/pricing">Pricing</a>
<a href="https://example.com" target="_blank" rel="noopener">External link</a>
<a href="#section-2">Jump to section 2</a>

Notes

  • target="_blank" without rel="noopener" gives the new page access to window.opener — a security risk, so always add rel="noopener".
  • An empty href or href="#" makes the element clickable without a real navigation — for actions that don't navigate, use a <button> instead.

Accessibility

  • Link text should describe its purpose ("Read more about pricing", not just "Here").
  • Icon-only links need an aria-label describing the action.

Related tools