Creating Links and Navigation

⏱️ 25 minutes

Links are what make the web truly interconnected. In this lesson, you'll learn how to create different types of links and build effective navigation systems for your websites.

🎯 Learning Objectives

  • Create basic hyperlinks with the anchor element
  • Understand different types of links (internal, external, email, phone)
  • Build navigation menus and site structure
  • Use link attributes for functionality and accessibility
  • Follow best practices for link text and usability
  • Implement accessible navigation patterns

Link Accessibility Best Practices

Descriptive Link Text

✅ Good Link Text

  • "Download the PDF report"
  • "Read our privacy policy"
  • "Contact our support team"
  • "Learn more about HTML5"

❌ Poor Link Text

  • "Click here"
  • "Read more"
  • "Link"
  • "www.example.com"

Keyboard Navigation

⌨️ Keyboard Accessibility

  • Tab key: Navigate between links
  • Enter key: Activate focused link
  • Skip links: Allow jumping to main content
  • Focus indicators: Visual feedback for focused links
Accessible Skip Link
<a href="#main-content" class="skip-link">Skip to main content</a>

<nav>
    <!-- Navigation menu -->
</nav>

<main id="main-content">
    <!-- Main page content -->
</main>

Practice Exercises

Exercise 1: Personal Website Navigation

Create a personal website with navigation:

  • Main navigation with 5 sections
  • Internal anchor links
  • Email and phone contact links
  • External social media links

Exercise 2: Business Card Page

Build a digital business card:

  • Contact information with clickable links
  • Social media profiles (external)
  • Portfolio/work samples links
  • Proper accessibility attributes

Lesson Summary

🎯 What You Learned

  • Anchor elements create clickable links
  • Different link types serve different purposes
  • Navigation menus structure website hierarchy
  • Link attributes control behavior and security
  • Accessible links benefit all users

🔑 Key Attributes

href
Link destination URL or anchor
target
Where to open the link
rel
Relationship and security settings
title
Additional information on hover

📝 Best Practices

  • Use descriptive link text
  • Add rel="noopener" to external links
  • Structure navigation logically
  • Test keyboard accessibility
  • Consider mobile users

🎉 Navigation Mastery!

You can now create effective links and navigation systems that connect your web content beautifully!

Next: Images and Media →

📝 My Notes