Navigation & Semantics

HTML <a> Tag

The <a> tag defines a hyperlink, which is used to link from one page to another.

Definition and Usage

The <a> tag defines a hyperlink, which is used to link from one page to another.

Standard Syntax:<a>...</a>

Interactive ExampleRunnable

HTML <a> Example

html
Try it Yourself
Live code demonstration for the <a> tag. Click "Try it Yourself" to edit and experiment in real time.
<div style="font-family: system-ui, sans-serif; padding: 16px; background: #ffffff; border-radius: 8px; border: 1px solid #e2e8f0; color: #0f172a;">
<a href="https://ea-academy.com">Visit EA Academy.com!</a>
</div>

Attributes for <a>

9 Supported Attributes
AttributeValuesDefaultDescription
downloadfilenamenoneSpecifies that the target will be downloaded when a user clicks on the hyperlink
hrefURLnoneSpecifies the URL of the page the link goes to
hreflanglanguage_codenoneSpecifies the language of the linked document
mediamedia_querynoneSpecifies what media/device the linked document is optimized for
pinglist_of_URLsnoneSpecifies a space-separated list of URLs to which, when the link is followed, post requests with the body ping will be sent by the browser (in the background). Typically used for tracking.
referrerpolicyno-referrerno-referrer-when-downgradeorigin origin-when-cross-originsame-originstrict-origin-when-cross-originunsafe-urlnoneSpecifies which referrer information to send with the link
relalternate author bookmarkexternal help license next nofollow noreferrernoopener prev search tagnoneSpecifies the relationship between the current document and the linked document
target_blank _parent _self _topnoneSpecifies where to open the linked document
typemedia_typenoneSpecifies the media type of the linked document
Global Attributes

The <a> tag also supports the standard global attributes in HTML, including class, id, style, title, hidden, and data-*.

HTML Global Attributes Reference →
Event Attributes

The <a> tag supports event attributes in HTML, such as onclick, onmouseover, onfocus, and more.

HTML Event Attributes Reference →

Browser Compatibility

ChromeEdgeFirefoxSafariOpera

More Tags in Navigation & Semantics

View All 123Tags →