An HTML link allows users to navigate between webpages, sections of a webpage, or external websites. Links are created using the <a>
(anchor) tag.
<a href="URL">Link Text</a>
✔ href
(Hypertext REFerence) specifies the destination URL.
✔ Link Text
is what users click on.
<a href="https://www.google.com">Visit Google</a>
✔ Opens Google’s website.
<a href="about.html">About Us</a>
✔ Redirects to another page within the same website.
<a href="mailto:example@email.com">Send Email</a>
✔ Opens the default email client to send an email.
✔ On mobile, clicking dials the number.
Use target="_blank"
to open a link in a new tab.
<a href="https://example.com" target="_blank">Open in New Tab</a>
✔ Useful for external websites.
You can create jump links using id
.
<h2 id="contact">Contact Us</h2>
<a href="#contact">Go to Contact Section</a>
✔ Clicking the link scrolls to the Contact section.
Type of Link | Example |
---|---|
External Link | <a href="https://google.com">Google</a> |
Internal Link | <a href="about.html">About Us</a> |
Email Link | <a href="mailto:test@example.com">Email Us</a> |
Phone Link | <a href="tel:+1234567890">Call Us</a> |
Open in New Tab | <a href="https://example.com" target="_blank">New Tab</a> |
Page Section Link | <a href="#section">Jump to Section</a> |
✔ Use descriptive link text (avoid "Click Here").
✔ Use target="_blank"
for external links.
✔ Style links for better visibility.
✔ Ensure accessibility for all users.
@asadmukhtar