Published Jul 1, 2022
Contribute to Docs

The <a> element, also known as the “anchor” element, creates a link to another page or to a location in the current page. It can also be used to link to email addresses, phone numbers, and files.


<a href="url">Displayed Text</a>

The following attributes are commonly used in the <a> element:

  • href, which represents the URL that the link points to.
  • target, which represents where to open and display the URL stored in the href.
  • rel, which describes the link type of for the element (e.g., using "noopener" and "noreferrer" when adding browser safeguards to links).


The following example shows a list of links that utilize the <a> element:

<!-- External Link -->
<a href="https://codecademy.com" target="_blank" rel="noreferrer noopener"
<!-- Internal Link -->
<li><a href="#about-us">About Us</a></li>
<!-- Image Link -->
<a href="http://www.codecademy.com">
<!-- Email and Phone Links -->
<li><a href="mailto:[email protected]">[email protected]</a></li>
<li><a href="tel:234-555-1212">234-555-1212</a></li>

The rendered output would look like this:

Rendered anchor tags

All contributors

Looking to contribute?

Learn HTML on Codecademy