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
htmlLive 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| Attribute | Values | Default | Description |
|---|---|---|---|
| download | filename | none | Specifies that the target will be downloaded when a user clicks on the hyperlink |
| href | URL | none | Specifies the URL of the page the link goes to |
| hreflang | language_code | none | Specifies the language of the linked document |
| media | media_query | none | Specifies what media/device the linked document is optimized for |
| ping | list_of_URLs | none | Specifies 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. |
| referrerpolicy | no-referrerno-referrer-when-downgradeorigin origin-when-cross-originsame-originstrict-origin-when-cross-originunsafe-url | none | Specifies which referrer information to send with the link |
| rel | alternate author bookmarkexternal help license next nofollow noreferrernoopener prev search tag | none | Specifies the relationship between the current document and the linked document |
| target | _blank _parent _self _top | none | Specifies where to open the linked document |
| type | media_type | none | Specifies 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-*.
Event Attributes
The <a> tag supports event attributes in HTML, such as onclick, onmouseover, onfocus, and more.
Browser Compatibility
ChromeEdgeFirefoxSafariOpera
More Tags in Navigation & Semantics
View All 123Tags →<address>The <address> tag defines the contact information for the author/owner of a document or an article.<article>The <article> tag specifies independent, self-contained content.<aside>The <aside> tag defines some content aside from the content it is placed in.<footer>The <footer> tag defines a footer for a document or section.<h1> to <h6>The <h1> to <h6> tags are used to define HTML headings.<header>The <header> element represents a container for introductory content or a set of navigational links.