KoderSolution Logo
HomeArticlesTutorialsForumAI LabRun Code
KoderSolution Logo

The world’s most advanced technical ecosystem for modern software engineers. Learn, build, and grow with next-generation developer tools and resources.

Engineering Newsletter

Join 100,000+ engineers receiving curated high-signal content weekly.

Platforms

  • Technical Articles
  • Interactive Tutorials
  • AI Coding Lab
  • Developer Forum
  • Developer Tools

Pages

  • About Us
  • Contact Us
  • Privacy Policy
  • Terms of Service
  • Refund Policy
  • Disclaimer
  • Advertisement

Popular Topics

  • PHP
  • Laravel
  • Python
  • React.Js
  • MySQL
© 2026 KoderSolutionAll Rights Reserved
Developed Bymaksudur.dev
🌐

HTML

Topic Hub & Articles

HTML HOME

3 min

HTML Introduction

5 min

HTML Editors

10 min

Recap Quiz

5 Questions

HTML Basic

10 min

HTML Elements

10 min

HTML Attributes

10 min

HTML Headings

10 min

HTML Styles

10 min

HTML Paragraphs

10 min

Recap Quiz

5 Questions

HTML Formatting

10 min

HTML Quotations

10 min

HTML Comments

10 min

HTML Colors

7 min

HTML CSS

10 min

Recap Quiz

5 Questions

HTML Links

10 min

HTML Images

10 min

HTML Favicon

10 min

HTML Page Title

10 min

HTML Tables

10 min

Recap Quiz

5 Questions

HTML Lists

10 min

HTML Block and Inline

10 min

HTML Classes

10 min

HTML Id

10 min

HTML Iframes

10 min

Recap Quiz

5 Questions

HTML JavaScript

10 min

HTML File Paths

10 min

HTML Head

10 min

HTML Layout

10 min

HTML Responsive

10 min

Recap Quiz

5 Questions

HTML Computercode

10 min

HTML Forms

10 min

Recap Quiz

5 Questions

HTML Form Attributes

10 min

HTML Form Elements

10 min

HTML Input Types

10 min

HTML Input Attributes

10 min

Recap Quiz

5 Questions

HTML Input Form Attributes

10 min

HTML Canvas

10 min

HTML SVG

10 min

Recap Quiz

5 Questions

HTML Media Intro

10 min

HTML Video

10 min

HTML Audio

10 min

Recap Quiz

5 Questions

HTML YouTube

10 min

HTML Geolocation

10 min

HTML Drag/Drop

10 min

HTML Local Storage

10 min

HTML Session Storage

10 min

HTML Web Workers

10 min

HTML SSE

10 min

HTML Semantics

10 min

HTML Accessibility

10 min

HTML Entities

10 min

HTML Symbols

10 min

HTML Emojis

10 min

HTML Charset

10 min

HTML URL Encode

10 min

Recap Quiz

5 Questions

HTML XHTML

10 min

HTML Global Attributes

10 min

HTML Event Attributes

10 min

HTML Color Groups

10 min

Recap Quiz

5 Questions

HTML URL Paths

10 min

HTML Summary

10 min

Progress
0%

0 / 61 Lessons

HTMLHTML Tutorial
Lesson

HTML Links

10 min reading
Free Course

HTML Links: Hyperlinks, Anchor Tags, href, and target Attributes

HTML links (hyperlinks) enable navigation between web pages, external websites, downloadable assets, or specific sections within the same page. Links are created using the <a> (anchor) element.

Anchor Tag Syntax and Key Attributes

The <a> tag wraps text, buttons, or images to turn them into clickable hyperlinks.

<a href="https://kodersolution.com/tutorials" target="_blank" rel="noopener noreferrer">Explore Tutorials</a>

Key attributes for <a>:

  1. href (Hypertext Reference): Specifies the destination URL (absolute path, relative path, or anchor hash #id).
  2. target: Controls where the linked document opens:
    • _self (Default): Opens in the current tab/window.
    • _blank: Opens in a new browser tab or window.
    • _parent / _top: Opens in the parent or top-level frame.
  3. rel: Defines the relationship between current and target pages. Essential for security (rel="noopener noreferrer") when using target="_blank".
  4. download: Instructs the browser to download the target file rather than navigating to it.

Link Destination Types

HTML anchor tags handle several navigation mechanisms:

flowchart TD
    A["HTML Hyperlinks (a)"] --> B["Absolute URLs (External)"]
    A --> C["Relative URLs (Internal)"]
    A --> D["Page Section Anchors (#id)"]
    A --> E["Action Links (mailto: / tel:)"]
    B --> B1["https://example.com"]
    C --> C1["/about.html or ../contact"]
    D --> D1["#features or #top"]
    E --> E1["mailto:[email protected]"]

Practical Code Example

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>HTML Links Practical Example</title>
</head>
<body style="font-family: system-ui, sans-serif; background-color: #0f172a; color: #f8fafc; padding: 2rem;">

    <h1 id="top">HTML Links Demonstration</h1>

    <!-- Navigation Bar with Relative Links and Hash Anchors -->
    <nav style="background-color: #1e293b; padding: 1rem; border-radius: 8px; margin-bottom: 2rem;">
        <a href="#section-features" style="color: #38bdf8; margin-right: 1.5rem; text-decoration: none;">Jump to Features</a>
        <a href="https://developer.mozilla.org" target="_blank" rel="noopener noreferrer" style="color: #38bdf8; margin-right: 1.5rem; text-decoration: none;">External MDN Docs ↗</a>
        <a href="mailto:[email protected]" style="color: #38bdf8; text-decoration: none;">Email Support</a>
    </nav>

    <!-- Page Content Section -->
    <div id="section-features" style="background-color: #1e293b; padding: 1.5rem; border-radius: 8px; margin-top: 10rem;">
        <h2>Key Features Section</h2>
        <p>This section is reached directly via smooth anchor hash scrolling (`#section-features`).</p>
        
        <!-- Back to Top Link -->
        <a href="#top" style="color: #34d399; font-weight: bold; text-decoration: none;">↑ Back to Top</a>
    </div>

</body>
</html>

Best Practices

  • Always pair target="_blank" with rel="noopener noreferrer": Prevents tab-nabbing security vulnerabilities by preventing external pages from accessing window.opener.
  • Use clear, descriptive link text: Avoid vague text like "click here". Use meaningful anchor labels like "Read the HTML Attributes Guide".
  • Ensure high contrast for visual accessibility: Link text colors must meet WCAG 2.1 contrast guidelines against background colors, with visible :focus states for keyboard navigation.
  • Differentiate relative vs absolute paths: Use relative paths (/blog/post-1) for internal site navigation to maintain local development compatibility.

Self-Check Challenge

Create an anchor link that opens https://github.com in a new tab safely with rel="noopener noreferrer", styled with custom text color and hover underline effects!

Save Your Progress

Unlock Your
Full Potential.

Sign in to track your learning journey, earn industry-recognized certificates, and join our elite developer community.

Quick Access With

Enterprise-Grade Security Protocol

Recommended Courses & Books

Try it Yourself

Experiment with the code from this lesson in our interactive playground.

Open Playground

Stuck on this lesson?

Join our community of senior developers.

Ask in Forum