HTML <a> Tag
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>
2. Linking to a Section on the Same Page (Anchor Links)
<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.
4. Email Links
<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
Attributes
- 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.
- target
-
Specifies the target frame to load the page into.
Possible Values:- _blank
- _self
- _top
- _parent
- 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
- noreferrer
- prefetch
- prev
- search
- tag
- media
-
Specifies what media/device the target URL is optimized for. Default value:
all. - hreflang
-
Specifies the base language of the resource designated by
hrefand may only be used whenhrefis specified. - type
-
Specifies the MIME type of the linked resource. Only to be used when the
hrefattribute is present.
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
Tablets & Mobile
Last updated by CSSPortal on: 24th December 2025
