Favorites

HTML <a> Tag

<a>
HTML TagThis tag is supported by all modern browsers.
Updated 24th December 2025

The <a> tag creates a hyperlink to another page, a file, an email address or a location on the same page. Its href attribute sets the destination.

Looks like you're using an ad blocker, and that's fine! Ads help keep CSS Portal's generators and references free, so if the site's useful to you, visit our Support page to see other ways to help.

Description

The <a> HTML element is one of the most important in HTML and is intended for creating links. To do this, you need to tell the browser what the link is, and also indicate the address of the document to which you want to link. The value of the href attribute is the address of the document to which the transition takes place. The link address can be absolute and relative. Absolute addresses work everywhere, regardless of the name of the site or web page where the link is registered. Relative links, as their name implies, are built relative to the current document or the root of the site. The <a> element is usually referred to as a link or a hyperlink.

Common Uses of the <a> Tag

1. Linking to Another Web Page

<a href="https://www.cssportal.com">Visit CSS Portal</a>
<a href="#features">Go to Features</a>

<section id="features">
  <h2>Features</h2>
</section>

3. Opening Links in a New Tab

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

Using rel="noopener noreferrer" improves security and performance when opening new tabs.

<a href="mailto:info@example.com">Send Email</a>

You can also include a subject:

<a href="mailto:info@example.com?subject=Hello">Email Us</a>

5. Telephone Links

<a href="tel:+1234567890">Call Us</a>

Especially useful for mobile devices.

6. Download Links

<a href="file.pdf" download>Download PDF</a>

You can also specify a filename:

<a href="file.pdf" download="guide.pdf">Download Guide</a>

Properties

Permitted Parents
Any element that accepts phrasing content, or any element that accepts flow content, but always excluding <a> elements.
Content
Inline and text
Start/End Tags
Start tag: required, End tag: required

Example

Example of the <a href="https://www.cssportal.com/html-tags/tag-a.php" target="_blank">a tag</a>, used in html.
Open in editor

Attributes

download
Tells the browser to download the linked resource rather than navigate to it. An optional value sets the suggested file name.
href
Specifies the location of a Web resource, thus defining a link between the current element (the source anchor) and the destination anchor defined by this attribute.
hreflang
Specifies the base language of the resource designated by href and may only be used when href is specified.
interestfor
The id of an element (usually a popover) to show when the user shows interest in this element, for example by hovering or focusing it. This attribute is experimental.
ping
A space-separated list of URLs that the browser notifies (with a POST request) when the link is followed.
referrerpolicy
Controls how much referrer information is sent when fetching the resource or following the link.

Possible Values:
  • no-referrer
  • no-referrer-when-downgrade
  • origin
  • origin-when-cross-origin
  • same-origin
  • strict-origin
  • strict-origin-when-cross-origin
  • unsafe-url
rel
Specifies the relationship from the current document to the anchor specified by the href attribute. Multiple values can be provided, separated by a space.

Possible Values:
  • alternate
  • author
  • bookmark
  • external
  • help
  • license
  • next
  • nofollow
  • noopener
  • noreferrer
  • opener
  • prefetch
  • prev
  • privacy-policy
  • search
  • tag
  • terms-of-service
target
Specifies the target frame to load the page into.

Possible Values:
  • _blank
  • _self
  • _top
  • _parent
type
Hints at the MIME type of the linked resource. Only used when href is present.
media
Specifies what media/device the target URL is optimized for. This attribute has been removed from the HTML standard.

Global Attributes

The <a> tag also supports the Global Attributes in HTML5

Event Attributes

The <a> tag also supports the Event Attributes in HTML5

Browser Support

The following information will show you the current browser support for the HTML <a> tag. Hover over a browser icon to see the version that first introduced support for this HTML tag.

This tag is supported by all modern browsers.

Desktop

Chrome
Edge
Firefox
Opera
Safari

Tablets & Mobile

Chrome Android
Firefox Android
Opera Android
Safari iOS
Samsung Internet
Android WebView
-
Supported Unknown Not supported

Looks like you're using an ad blocker, and that's fine! Ads help keep CSS Portal's generators and references free, so if the site's useful to you, visit our Support page to see other ways to help.