HTML <a>
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.
Syntax
<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 thehref.rel, which describes the link type of for the element (e.g., using"noopener"and"noreferrer"when adding browser safeguards to links).
Example
The following example shows a list of links that utilize the <a> element:
<ul><!-- External Link --><li><a href="https://codecademy.com" target="_blank" rel="noreferrer noopener">Codecademy</a></li><!-- Internal Link --><li><a href="#about-us">About Us</a></li><!-- Image Link --><li><a href="http://www.codecademy.com"><imgsrc="https://raw.githubusercontent.com/Codecademy/docs/main/media/cc_logo.png"/></a></li><!-- Email and Phone Links --><li><a href="tel:234-555-1212">234-555-1212</a></li></ul>
The rendered output would look like this:

Contribute to Docs
- Learn more about how to get involved.
- Edit this page on GitHub to fix an error or make an improvement.
- Submit feedback to let us know how we can improve Docs.
Learn HTML on Codecademy
- Front-end engineers work closely with designers to make websites beautiful, functional, and fast.
- Includes 34 Courses
- With Professional Certification
- Beginner Friendly.115 hours
- Start at the beginning by learning HTML basics — an important foundation for building and editing web pages.
- Beginner Friendly.7 hours