Creating links with the a tag
What we will go through
- The anchor element and the href attribute
- Writing descriptive anchor text
- target="_blank" and rel="noopener"
- mailto:, tel:, and download links
Short answer
A link is an <a> element, called an anchor. The href attribute holds the destination URL, and the text between the tags is the anchor text people click. Good anchor text says where the link goes. You can also link to email addresses, phone numbers, and files.
The anchor element
<a href="https://freecourses.digital/">Free digital marketing courses</a>
href means hypertext reference. Without it, the a tag is not a working link. The words inside are the anchor text, also called link text.
Write descriptive anchor text
| Weak | Better |
|---|---|
| Click here | Download the 2026 price list (PDF) |
| Read more | Read the full Cagsawa Ruins guide |
| This link | See our delivery areas in Albay |
Screen reader users often pull up a list of all links on a page. Ten links that say click here tell them nothing. Search engines also use anchor text to understand the page being linked.
Opening links in a new tab
<a href="https://www.dti.gov.ph/" target="_blank" rel="noopener">DTI website (opens in a new tab)</a>
target="_blank" opens a new tab. Add rel="noopener" so the new page cannot control your page. Use new tabs sparingly, mainly for external sites or files, and tell people it will open in a new tab.
Email, phone, and download links
<a href="mailto:orders@example.com?subject=Order">Email us</a>
<a href="tel:+639171234567">Call 0917 123 4567</a>
<a href="/files/menu.pdf" download>Download our menu</a>
On phones, tel: links let customers call with one tap. That alone can raise inquiries for a small business. Use the international format, +63, in the href.
Try it: make tappable contact links
Turn the phone number into a tel: link and the email into a mailto: link. Rewrite “click here” into clear anchor text.
Live preview
Quick quiz
Common mistakes
- Vague anchor text. Click here and read more hide where a link goes.
- Opening every link in a new tab. It breaks the Back button. Keep internal links in the same tab.
- Linking without https. Use full https:// URLs for external sites.
- Bare phone numbers. Wrap them in tel: links so mobile users can tap.
Your action
Tick each item when you can do it. Your progress saves on this device.
Key terms
- Anchor element
- The <a> element that creates a link.
- href
- The attribute that holds a link's URL.
- Anchor text
- The clickable words of a link.
- target="_blank"
- Opens the link in a new tab.
- rel="noopener"
- Stops a new tab from controlling the original page.
- mailto:
- A link scheme that opens an email app.
- tel:
- A link scheme that starts a phone call.
Questions beginners ask
Can an image be a link?
Yes. Put the <img> inside the <a>, and give the image alt text that describes the destination.
What is rel="nofollow"?
It tells search engines not to pass trust through that link, often used for paid or user-submitted links.
How do I link to a Facebook page?
Use the full URL, like https://www.facebook.com/yourpage.
Related lessons
Need a website built or fixed while you practice? The team at Remar Digital can help.