The Fundamental Way to Create Links (But Much More Than You Think)
Do you know what really makes the internet… the internet?
Not CSS.
Not JavaScript.
Links.
Yes, that innocent-looking <a> tag right there…
Without it, the web would be a silent cry of lonely pages 🥲
In this article, we won’t just learn how to use the <a> tag, but:
- how to use it correctly
- how to use it smartly
- how to use it professionally
Grab your coffee ☕
Let’s start dropping links 🔗
What Is the <a> Tag? (Anchor = Anchor ⚓)
The <a> tag comes from the English word anchor.
Yes, literally “anchor”.
It attaches to a point and takes you somewhere else.
In the web world, it means this:
👉 A door that takes the user from one place to another
That place can be:
- Another website
- Another page within the same site
- A section on the same page
- An email application
- Even a phone call 📞
In short, the <a> tag is a true traveler 🧭
The Most Basic Usage (The Ancestor of All Links)
Let’s break down its DNA:
<a href="https://www.google.com">Go to Google</a>
What’s happening here?
<a>→ The link startshref→ The answer to “Where are we going?”Go to Google→ The text visible to the user
🧠 Wisdom note:
If there’s no href, the <a> tag doesn’t work.
It becomes nothing more than a link-shaped illusion.
What Is href? (The Heart of the Link ❤️)
href stands for Hypertext Reference.
In other words:
“Where should the browser go when this link is clicked?”
Examples:
1️⃣ External Website
<a href="https://openai.com">OpenAI</a>
2️⃣ Page Within the Same Site
<a href="about.html">About Us</a>
3️⃣ Page Inside a Folder
<a href="pages/contact.html">Contact</a>
📌 Practical tip:
If a link doesn’t work, there’s a 90% chance the file path is wrong.
Opening a Link in a New Tab (target="_blank")
The user clicks the link…
And you say:
“Go ahead, but don’t leave me.”
That’s when you do this:
<a href="https://github.com" target="_blank">
GitHub
</a>
Is this enough?
Professional answer: No.
Secure Version (Senior Developer Mood 😎)
<a
href="https://github.com"
target="_blank"
rel="noopener noreferrer"
>
GitHub
</a>
🛡️ What does this do?
- Prevents the new tab from controlling your page
- Improves security and performance
Small detail. Big difference.
Email Links (An HTML Surprise ✉️)
No forms.
No JavaScript.
<a href="mailto:example@mail.com">
Send Me an Email
</a>
Want something cooler?
<a href="mailto:example@mail.com?subject=Hello&body=Hi there!">
Send an Email with Subject
</a>
📌 Notes:
subject→ Email subjectbody→ Email content
Yes, HTML can be a magician sometimes 🪄
Phone Call Links 📞
If you care about mobile users, you’ll love this:
<a href="tel:+905551112233">
Call Now
</a>
User clicks:
📱 “Hello?”
📌 Especially valuable for:
- Restaurant websites
- Consulting services
- Emergency pages
Pure gold.
In-Page Links (Teleport Feature 🚀)
You have a long page.
The user scrolls… and scrolls… and scrolls.
Solution?
<a href="#contact">Go to Contact</a>
...
<section id="contact">
<h2>Contact</h2>
</section>
🧠 Logic:
#contact→ Teleport to the matching ID- Scroll = poof 💨
📌 This method is SEO- and UX-friendly.
Styling Links (Goodbye Ugly Blue 🎨)
Default links are:
- Blue
- Underlined
- Giving strong 2003 vibes 😬
We’re frontend developers.
We don’t accept that.
a {
text-decoration: none;
color: #ff5722;
font-weight: 600;
}
a:hover {
color: #000;
text-decoration: underline;
}
Bonus effect:
a {
transition: color 0.3s ease;
}
✨ Small animation = big happiness
Using <a> Like a Button
Sometimes a link should look like a button:
<a href="/sign-up" class="btn">
Sign Up
</a>
.btn {
padding: 10px 20px;
background: black;
color: white;
border-radius: 8px;
}
📌 Golden rule:
- If it navigates somewhere →
<a> - If it performs an action →
<button>
A frontend developer who knows this starts 1–0 ahead 🏆
Common Mistakes (Red Card 🚨)
❌ <a> tag with href="#"
❌ “Click here” (Where? Why?)
❌ Every link opens in a new tab
❌ It’s not clear that the text is clickable
❌ Accessibility is ignored
SEO & Accessibility Mini Tips 🧠
✅ Use descriptive link text
<a href="/blog/html-a-tag">
HTML `<a>` Tag Guide
</a>
❌ Bad example:
<a href="/blog/html-a-tag">Click here</a>
Both Google and users want to know what they’re clicking on.
Summary: <a> Is Small but Legendary
- The
<a>tag creates links hrefis essential- New tabs should be used consciously
- Email, phone, and in-page links are possible
- CSS gives links personality
- SEO and accessibility make the difference
🎯 Final Word:
The <a> tag may look like the simplest HTML tag,
but when used correctly,
it’s the bridge that takes you from amateur to professional.
