HTML Elements: <a>
Description
The <a> (anchor) element creates a hyperlink to another resource. Links can point to web pages, files, email addresses, telephone numbers, locations within the same page, or other resources identified by a URL. It is one of the most fundamental elements in HTML and is the primary way users navigate between pages on the web.
An anchor becomes an interactive hyperlink when the href attribute is provided. Without href, the element does not function as a standard link and is generally not keyboard focusable.
<a href="URL">Link text.</a>
Attributes
The <a> element supports all global attributes in addition to the element specific attributes described below.
(empty)filename<a href="guide.pdf" download="user-guide.pdf">Download PDF</a>
absolute_urlrelative_urlroot_relative_urlfragment_idtext_fragmentemail_addresstel_numbersmsftp_urljs_url<a href="https://www.example-web.site/files/report.pdf">Absolute URL</a> <a href="about.html">Relative URL</a>
lang_codelang_ctry_code<!-- English --> <a href="about.html" hreflang="en">About Us</a> <!-- English United States --> <a href="about.html" hreflang="en-us">About Us</a>
target_id<p><a href="#" interestfor="info">More Information</a></p> <div id="info" popover>Additional details appear here.</div>
urlurl url<!-- Single Ping URL --> <a href="https://www.example-web.site" ping="https://tracker.example.com/ping">Visit Example</a> <!-- Multiple Ping URLs --> <a href="https://www.example-web.site" ping="https://tracker.example.com/ping https://analytics.example.com/click">Visit Example</a>
no-referrerno-referrer-when-downgradeoriginorigin-when-cross-originsame-originstrict-originstrict-origin-when-cross-originunsafe-url<a href="https://www.example-web.site" referrerpolicy="strict-origin-when-cross-origin">Visit Example</a>
alternateauthorbookmarkexternalhelplicensemenextnofollownoopenernoreferreropenerprevprivacy-policysearchtagterms-of-serviceugc<!-- Single Value --> <a href="https://example-web.site" rel="terms-of-service">Terms of Services</a> <!-- Multiple Values --> <a href="https://example-web.site" rel="noopener noreferrer">Visit Example</a>
_self_blank_parent_top_unfencedTop<p><a href="#" interestfor="info">More Information</a></p> <div id="info" popover>Additional details appear here.</div>
text/htmltext/plaintext/csstext/javascriptapplication/pdfapplication/jsonapplication/xmlimage/jpegimage/pngimage/svg+xmlaudio/mpegvideo/mp4application/zip<!-- application/pdf --> <a href="guide.pdf" type="application/pdf">User Guide</a> <!-- video/mp4 --> <a href="movie.mp4" type="video/mp4">Watch Video</a>
Browser Compatibility
Always use the latest version of your browser. Using the latest browser version is crucial for security, performance (faster loading), and compatibility (properly displaying modern websites). Updated browsers protect personal data from hackers, improve speed, and fix bugs that cause crashes.
Widely Available
Baseline Widely Available indicates a feature has been supported by core browsers for at least 30 months. At this stage, the feature is considered stable and safe for most websites to use without needing to worry about compatibility issues or fallbacks, as it is supported by the vast majority of users' devices and browser versions.
* Some parts of this feature may have varying levels of support.
Most browsers will display the <a> element with the following default values:
Related Elements
See Also:
HTML Element List
HTML Semantic Elements
HTML Attribute List
HTML Global Attributes
References:
caniuse.com
web.dev


