3 min read · Free · No login needed
Links are what make the web a web. The <a> tag (short for anchor) creates a link, and the href attribute says where it goes. The text between the tags is what the visitor clicks.
<a href="https://kamaldnp.com">KAMALDNP</a>. Always use the full address starting with https://.<a href="about.html">About Us</a>. Use a relative path, no domain needed.<a href="#contact">Jump to Contact</a>.<a href="mailto:support@kamaldnp.com">Email Us</a>.<a href="tel:+918318013442">Call Us</a>.Add target="_blank" and, for safety, rel="noopener": <a href="https://example.com" target="_blank" rel="noopener">Open in new tab</a>. Use this for external links, so your visitor does not leave your site. For links inside your own site, let them open in the same tab.
Write link text that describes the destination: "Download the BTEUP syllabus" is good; "click here" is bad. Google reads link text to understand what the linked page is about, and screen-reader users often jump from link to link without reading the surrounding words.
<img> tag between the <a> tags.A link, or anchor, is created with the <a> tag. It turns text (or an image) into something clickable. The href attribute holds the destination. Without href, the <a> tag is just plain text — it looks like a link but does nothing.
| Attribute | Value | Description |
|---|---|---|
href | a web address or path | Where the link goes. Required. |
target | _blank, _self | _blank opens a new tab; _self is the default, same tab. |
title | text | A small tooltip shown when you hover over the link. |
download | file name (optional) | Downloads the target instead of opening it. |
rel | noopener | Security setting — use it with target="_blank". |
Links can point to many things. Here are four common kinds:
<a href="https://kamaldnp.com">Our website</a> <a href="about.html">About page</a> <a href="#contact">Jump to the contact section</a> <a href="mailto:support@kamaldnp.com">Email us</a>
target="_blank", always add rel="noopener". Without it, the new page can reach back and control your page through JavaScript — a real security risk.</a> — everything after it becomes one giant link._blank.<a href="https://kamaldnp.com">KAMALDNP Academy</a> is an external link — the full address starting with https:// takes the visitor to another website.<a href="about.html">About Us</a> is an internal link — a short relative path that points to another page on the same site.<a href="#contact">Jump to Contact</a> jumps to the <h2 id="contact"> further down the same page, instead of loading a new page.<a href="mailto:support@kamaldnp.com">Email Us</a> opens the visitor's email app with the address already filled in.<br> after each link puts the next link on a new line, so the links stack vertically instead of running together.<!DOCTYPE html>
<html>
<head>
<title>Links</title>
</head>
<body>
<a href="https://kamaldnp.com">KAMALDNP Academy</a><br>
<a href="about.html">About Us</a><br>
<a href="#contact">Jump to Contact</a><br>
<a href="mailto:support@kamaldnp.com">Email Us</a>
<h2 id="contact">Contact</h2>
<p>Reach us any time.</p>
</body>
</html>
Change the code below and press Run to see the result instantly. No file to save, no login needed.
The questions learners ask most about this lesson — read the question, then open it to see the answer.
Use the a tag with an href attribute; the text between the tags is what the visitor clicks.
External links use a full address starting with https, while internal links use a short relative path to another page on your own site.
Add target blank and rel noopener. Use this for external links, so your visitor does not leave your site.
AI can write code for you, but it cannot think for you. When you learn HTML yourself, your brain builds the real skill: you understand why a page looks the way it does, you can fix it when it breaks, and you can answer it in an exam or an interview without help. That is the skill that gets you a job — not a copied answer.
Finish all 35 lessons, pass the test (80%), pay ₹10 and get your certificate.
Take the testPrefer watching? Video courses teach the same topics step by step.
Free tutorials teach you the basics. Our paid courses add live projects, mentorship and a certificate.
Browse all coursesAsk about courses, website & more
Request human callback:
Please log in to download. You will stay on this page after logging in!
New here? Register now →