📖 Scenario: You are creating a simple contact section for a website. Visitors should be able to click on an email address to open their email app and click on a phone number to call directly from their phone or device.
🎯 Goal: Build a contact section with clickable email and phone links using proper HTML anchor tags.
📋 What You'll Learn
Use an anchor tag with href starting with mailto: for the email link
Use an anchor tag with href starting with tel: for the phone link
Include accessible text inside the links
Use semantic HTML with a section element for the contact area
💡 Why This Matters
🌍 Real World
Contact sections on websites often use email and phone links so visitors can easily reach out.
💼 Career
Web developers must know how to create accessible and functional contact links for user interaction.
Progress0 / 4 steps
1
Create the contact section skeleton
Create a section element with the id attribute set to contact. Inside it, add a heading <h2> with the text Contact Us.
HTML
Hint
Use a section tag with id="contact" and add a heading inside it.
2
Add the email link
Inside the section with id="contact", add an anchor tag <a> with the href attribute set to mailto:support@example.com. The link text should be support@example.com.
HTML
Hint
Use href="mailto:support@example.com" in the anchor tag to create an email link.
3
Add the phone link
Below the email link inside the section, add another anchor tag <a> with the href attribute set to tel:+1234567890. The link text should be +1 234 567 890.
HTML
Hint
Use href="tel:+1234567890" in the anchor tag to create a phone link.
4
Add spacing and accessibility
Add a aria-label attribute to the email link with the value Send email to support@example.com. Add a space or line break between the email and phone links for better readability.
HTML
Hint
Add aria-label to the email link and use a <br> tag between links for spacing.
Practice
(1/5)
1. What does the mailto: prefix do when used in an <a> tag?
easy
A. It creates a link that opens the user's email program to send an email.
B. It creates a link that calls a phone number.
C. It creates a link that downloads a file.
D. It creates a link that opens a website.
Solution
Step 1: Understand the mailto: prefix
The mailto: prefix in an <a> tag tells the browser to open the default email program when clicked.
Step 2: Compare with other prefixes
The tel: prefix is for phone calls, not emails. Other prefixes like http: open websites.
Final Answer:
It creates a link that opens the user's email program to send an email. -> Option A
<a href="mailto:support@example.com" aria-label="Send email to support">Email Support</a><br><a href="tel:+1234567890" aria-label="Call support phone number">Call Support</a> uses clear link text and aria-label attributes to describe the links for screen readers.
Step 2: Compare with other options
<a href="mailto:support@example.com">support@example.com</a><br><a href="tel:+1234567890">1234567890</a> shows raw contact info but lacks descriptive text. <a href="mailto:support@example.com">Click here</a><br><a href="tel:+1234567890">Call now</a> uses vague text. <a href="mailto:support@example.com" title="Email">Email</a><br><a href="tel:+1234567890" title="Phone">Phone</a> uses title which is less reliable for accessibility.
Final Answer:
<a href="mailto:support@example.com" aria-label="Send email to support">Email Support</a><br><a href="tel:+1234567890" aria-label="Call support phone number">Call Support</a> -> Option D
Quick Check:
Clear text + aria-label = best accessibility [OK]
Hint: Use clear text and aria-label for accessible contact links [OK]
Common Mistakes:
Using vague link text like 'Click here'
Not adding aria-labels for screen readers
Relying only on title attribute
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.