-
Hajipur, Bihar, 844101
HTML links (or hyperlinks) allow users to navigate from one page to another, either within the same site or to an external site. Links are created using the <a>
(anchor) tag.
<a href="URL">Link Text</a>
href
: The attribute that holds the destination URL.
Link Text
: The clickable text shown to the user.
<a href="https://www.google.com">Visit Google</a>
Type | Example |
---|---|
External Link | <a href="https://example.com">Go to site</a> |
Internal Link | <a href="about.html">About Us</a> |
Email Link | <a href="mailto:info@example.com">Email Us</a> |
Telephone Link | <a href="tel:+911234567890">Call Now</a> |
Anchor Link | <a href="#section2">Go to Section 2</a> (on same page) |
Use the target="_blank"
attribute:
<a href="https://www.google.com" target="_blank">Open in New Tab</a>
<a href="https://example.com" title="Visit Example Site">Visit</a>
When hovered, the user sees a tooltip.
<a href="https://example.com">
<img src="logo.png" alt="Site Logo">
</a>
By default:
Unvisited link = blue
Visited link = purple
Active link = red
You can change these styles using CSS.
<style>
a {
color: green;
text-decoration: none;
}
</style>
Q1. Create a link to https://www.google.com
.
Q2. Add a link that opens in a new tab.
Q3. Make an internal link to a file named contact.html
.
Q4. Add a mailto:
link to send an email.
Q5. Create a link that opens the dialer with a phone number.
Q6. Use #footer
to link to a section at the bottom of the same page.
Q7. Add a title to a link that says “Go to Home Page”.
Q8. Create an image link using your logo.
Q9. Change link color to green and remove underline using CSS.
Q10. Create a navigation menu using multiple <a>
tags.
Q1: Which tag is used to create a hyperlink in HTML?
Q2: What attribute specifies the URL of the page the link goes to?
Q3: How do you open a link in a new browser tab?
Q4: Which of the following creates an email link?
Q5: What does this do '<a href="#top">Back to top</a>' ?
Q6: What is the default color of an unvisited link?
Q7: Which attribute is used to show a tooltip when hovering over a link?
Q8: What will this link do '<a href="tel:1234567890">Call Us</a>' ?
Q9: Which tag is used to link to a CSS file?
Q10: Which is the correct syntax for a hyperlink?