Falytom logoFALYTOM
Games
ToolsUI ComponentsServicesProductsAbout
LoginSign Up
menu
  1. Home
  2. /Web Development
  3. /Html
  4. /Creating Links
Your Progress0%
0 of 76 completed

Topics

Getting Started

  • What is HTML?
  • How the Web Works
  • Setting Up Your Environment
  • Your First HTML Page

HTML Document Structure

  • The DOCTYPE Declaration
  • The HTML Element
  • The Head Section
  • Meta Tags
  • The Body Element
  • HTML Comments

Text and Formatting

  • Headings (h1-h6)
  • Paragraphs
  • Line Breaks and Horizontal Rules
  • Text Formatting (Bold, Italic, etc.)
  • Quotations and Citations
  • Preformatted Text and Code
  • Subscript and Superscript

Links and Navigation

  • Creating Links
  • Absolute vs Relative URLs
  • Link Targets and Attributes
  • Email and Phone Links
  • Internal Page Links

Images and Media

  • Adding Images
  • Image Attributes
  • Image Formats
  • Figure and Figcaption
  • Responsive Images
  • Audio Elements
  • Video Elements
  • Embedding Content

Lists

  • Unordered Lists
  • Ordered Lists
  • Description Lists
  • Nested Lists

Tables

  • Table Basics
  • Table Headers and Footers
  • Spanning Columns and Rows
  • Table Captions
  • Styling Tables

Forms - Part 1 (Basics)

  • Introduction to Forms
  • Text Input Fields
  • Labels and Placeholders
  • Textarea Element
  • Checkboxes
  • Radio Buttons

Forms - Part 2 (Advanced)

  • Select Dropdowns
  • File Upload Inputs
  • HTML5 Input Types
  • Form Validation
  • Form Buttons
  • Fieldsets and Legends
  • Form Accessibility

Semantic HTML

  • What is Semantic HTML?
  • Header and Footer
  • Nav Element
  • Main and Article
  • Section and Aside
  • Div vs Semantic Elements
  • Time and Mark Elements

HTML5 Features

  • HTML5 Overview
  • Canvas Element
  • SVG in HTML
  • Geolocation API
  • Drag and Drop
  • Local Storage
  • Web Workers

Web Accessibility

  • Introduction to Accessibility
  • ARIA Attributes
  • Keyboard Navigation
  • Alt Text Best Practices
  • Color Contrast and Typography
  • Testing for Accessibility

Best Practices & SEO

  • HTML Best Practices
  • SEO Fundamentals
  • Meta Tags for SEO
  • Structured Data

Creating Links

Connecting your web pages with hyperlinks

Links are what make the web a "web"—they connect pages together, allowing users to navigate between different content. The anchor element is one of the most important and frequently used elements in HTML.

The Anchor Element

The <a> element (short for "anchor") creates hyperlinks. The most important attribute of the anchor element is href (hypertext reference), which specifies the destination of the link.

basic-link.html
<a href="https://www.example.com">Visit Example Website</a>

This creates a clickable link that takes users to example.com when clicked.

Anatomy of a Link

Let's break down the parts of a link:

link-anatomy.html
<a href="https://www.example.com">Click Here</a>
   │          │                      │
   │          │                      └─ Link text (visible to users)
   │          └─ href attribute (destination URL)
   └─ Opening anchor tag
  • <a> - The opening anchor tag
  • href="..." - The destination URL
  • Link text - The clickable text users see
  • </a> - The closing anchor tag

Basic Link Examples

Linking to External Websites

external-links.html
<p>
  Visit <a href="https://www.google.com">Google</a> to search the web.
</p>

<p>
  Learn more at <a href="https://www.wikipedia.org">Wikipedia</a>.
</p>

<p>
  Follow us on <a href="https://www.twitter.com">Twitter</a>.
</p>

Linking to Other Pages on Your Site

internal-links.html
<nav>
  <a href="index.html">Home</a>
  <a href="about.html">About</a>
  <a href="contact.html">Contact</a>
  <a href="services.html">Services</a>
</nav>

Writing Good Link Text

The text between the anchor tags should be descriptive and tell users where the link will take them. This is important for both usability and accessibility.

❌ Poor link text:

MARKUP
<p>To learn more about HTML, <a href="tutorial.html">click here</a>.</p>

<p>Our privacy policy can be found <a href="privacy.html">here</a>.</p>

<p><a href="products.html">Read more</a> about our products.</p>

These don't tell users what they're clicking on!

✅ Good link text:

MARKUP
<p>Learn more in our <a href="tutorial.html">HTML tutorial</a>.</p>

<p>Read our <a href="privacy.html">privacy policy</a>.</p>

<p>Browse our <a href="products.html">product catalog</a>.</p>

Clear, descriptive text tells users exactly where they're going!

Link States and Styling

Links have different visual states that browsers style by default:

  • Unvisited links: Usually blue and underlined
  • Visited links: Usually purple
  • Active links: Usually red (while clicking)
  • Hover state: When you move your mouse over a link

You can customize these styles with CSS, but the default styling helps users understand what's clickable.

Building a Navigation Menu

Links are commonly used to create navigation menus for your website:

navigation.html
<!DOCTYPE html>
<html>
  <head>
    <title>My Website</title>
  </head>
  <body>
    <header>
      <nav>
        <ul>
          <li><a href="index.html">Home</a></li>
          <li><a href="about.html">About Us</a></li>
          <li><a href="services.html">Services</a></li>
          <li><a href="portfolio.html">Portfolio</a></li>
          <li><a href="contact.html">Contact</a></li>
        </ul>
      </nav>
    </header>
    
    <main>
      <h1>Welcome to My Website</h1>
      <p>This is the homepage content.</p>
    </main>
  </body>
</html>

Linking Images

You can make images clickable by wrapping them in anchor tags:

image-links.html
<a href="products.html">
  <img src="product-banner.jpg" alt="View our products">
</a>

<a href="https://www.example.com">
  <img src="logo.png" alt="Example Company Logo">
</a>

The Title Attribute

The title attribute provides additional information about the link. It appears as a tooltip when users hover over the link:

title-attribute.html
<a href="tutorial.html" title="Learn HTML from scratch">
  HTML Tutorial
</a>

<a href="pricing.html" title="View our pricing plans">
  Pricing
</a>

Note: Don't rely on the title attribute for critical information, as it's not accessible to touch screen users and screen readers may handle it inconsistently.

Links Don't Always Use HTTP

While most links start with http:// or https://, the href attribute can contain other types of URLs:

other-protocols.html
<!-- Email link -->
<a href="mailto:contact@example.com">Email Us</a>

<!-- Phone link -->
<a href="tel:+1234567890">Call Us</a>

<!-- FTP link -->
<a href="ftp://files.example.com">Download Files</a>

We'll cover email and phone links in more detail in a later lesson.

Empty or Placeholder Links

Sometimes during development, you might need a link that doesn't go anywhere yet:

placeholder-links.html
<!-- Using # as a placeholder -->
<a href="#">Coming Soon</a>

<!-- Empty href (not recommended) -->
<a href="">Placeholder</a>

<!-- JavaScript void (old method) -->
<a href="javascript:void(0)">Old Style</a>

Using href="#" is the most common approach, but remember to replace it with a real URL before your site goes live!

Accessibility Tips for Links

  • Use descriptive link text that makes sense out of context
  • Avoid generic phrases like "click here" or "read more"
  • Make sure links are visually distinct from regular text
  • Ensure sufficient color contrast for users with vision impairments
  • Don't rely solely on color to indicate links
  • Keep link text concise but informative

Common Mistakes to Avoid

  • Broken links: Always test your links to make sure they work
  • Forgetting the closing tag: Always close your <a> tags
  • Missing href attribute: Without href, it's not a functional link
  • Nesting links: Don't put links inside other links
  • Long link text: Keep link text concise and relevant

Key Takeaways

  • The <a> element creates hyperlinks
  • The href attribute specifies the link destination
  • Link text should be descriptive and meaningful
  • Links can point to external sites or internal pages
  • Images can be made clickable by wrapping them in anchor tags
  • Good link text improves both usability and accessibility
  • Always test your links to ensure they work correctly

What's Next?

Now that you understand the basics of creating links, you're ready to learn about different types of URLs. In the next lesson, we'll explore the difference between absolute and relative URLs, and when to use each type.

Know someone who'd find this guide helpful? Please share!

Previous
Subscript and Superscript
Next
Absolute vs Relative URLs

Never Miss a New HTML Tutorial

Join 1,000+ developers learning HTML step-by-step. Get new tutorials, tips, and exclusive resources delivered to your inbox - completely FREE.

You might also like

UI Components

Ready-made components for your projects

Developer Tools

Boost productivity with handy generators

HTML Game

Learn HTML concepts through interactive gameplay

Join Our Web Development Training Program

Master frontend & backend development with hands-on projects.

Menu

Topics

Getting Started

  • What is HTML?
  • How the Web Works
  • Setting Up Your Environment
  • Your First HTML Page

HTML Document Structure

  • The DOCTYPE Declaration
  • The HTML Element
  • The Head Section
  • Meta Tags
  • The Body Element
  • HTML Comments

Text and Formatting

  • Headings (h1-h6)
  • Paragraphs
  • Line Breaks and Horizontal Rules
  • Text Formatting (Bold, Italic, etc.)
  • Quotations and Citations
  • Preformatted Text and Code
  • Subscript and Superscript

Links and Navigation

  • Creating Links
  • Absolute vs Relative URLs
  • Link Targets and Attributes
  • Email and Phone Links
  • Internal Page Links

Images and Media

  • Adding Images
  • Image Attributes
  • Image Formats
  • Figure and Figcaption
  • Responsive Images
  • Audio Elements
  • Video Elements
  • Embedding Content

Lists

  • Unordered Lists
  • Ordered Lists
  • Description Lists
  • Nested Lists

Tables

  • Table Basics
  • Table Headers and Footers
  • Spanning Columns and Rows
  • Table Captions
  • Styling Tables

Forms - Part 1 (Basics)

  • Introduction to Forms
  • Text Input Fields
  • Labels and Placeholders
  • Textarea Element
  • Checkboxes
  • Radio Buttons

Forms - Part 2 (Advanced)

  • Select Dropdowns
  • File Upload Inputs
  • HTML5 Input Types
  • Form Validation
  • Form Buttons
  • Fieldsets and Legends
  • Form Accessibility

Semantic HTML

  • What is Semantic HTML?
  • Header and Footer
  • Nav Element
  • Main and Article
  • Section and Aside
  • Div vs Semantic Elements
  • Time and Mark Elements

HTML5 Features

  • HTML5 Overview
  • Canvas Element
  • SVG in HTML
  • Geolocation API
  • Drag and Drop
  • Local Storage
  • Web Workers

Web Accessibility

  • Introduction to Accessibility
  • ARIA Attributes
  • Keyboard Navigation
  • Alt Text Best Practices
  • Color Contrast and Typography
  • Testing for Accessibility

Best Practices & SEO

  • HTML Best Practices
  • SEO Fundamentals
  • Meta Tags for SEO
  • Structured Data
Falytom logoFALYTOM

Learn technologies like HTML, CSS, JavaScript, React, NodeJS and more through interactive games, tutorials, components and free tools. Transform your businesses with AI chatbots, SEO-optimized websites, and professional development services.

© 2025 Tomilola Group
  • Facebook logo
  • Twitter logo
  • Instagram logo
  • LinkedIn logo
  • GitHub logo
  • YouTube logo