<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
href, which represents the URL that the link points to.
target, which represents where to open and display the URL stored in the
rel, which describes the link type of for the element (e.g., using
"noreferrer"when adding browser safeguards to links).
The following example shows a list of links that utilize the
<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="mailto:[email protected]">[email protected]</a></li><li><a href="tel:234-555-1212">234-555-1212</a></li></ul>
The rendered output would look like this:
Interested in helping build Docs? Read the Contribution Guide or share your thoughts in this feedback form.
Learn HTML on Codecademy
Front-End EngineerFront-end engineers work closely with designers to make websites beautiful, functional, and fast.
Includes 34 Courses
With Professional Certification