HTML Links: Anchor Tags, URLs and Page Fragments
Learn how to create HTML links with anchor elements, relative and absolute URLs, email and phone links, and page fragments.
Create a link
The <a> element creates a link. Its href attribute gives the destination. Use link text that makes the destination clear.
<a href="html-images.htm">Learn about HTML images</a>
Use different URL forms
An absolute URL includes the scheme and domain, such as https://example.com/guide/. A relative URL is resolved from the current page, such as html-images.htm. A root-relative URL begins at the website root, such as /about-us/.
Link to a section
Give a destination element a unique id, then add that ID as a fragment to the link.
<a href="#contact-details">Jump to contact details</a>
<h2 id="contact-details">Contact details</h2>
Email, phone and new-tab links
Use mailto: for an email link and tel: for a phone number. When a link opens a new tab with target="_blank", tell users and add rel="noopener".