0Pricing
HTML Academy · Lesson

Absolute vs Relative URLs

Understand the difference between absolute and relative paths.

What Is a URL?

A URL (Uniform Resource Locator) is the full address of a resource on the web.

A URL has these parts:

https://example.com:443/products/widget?color=red#reviews
│     │           │   │               │          │
│     │           │   │               │          └─ Fragment
│     │           │   │               └─ Query string
│     │           │   └─ Path
│     │           └─ Port
│     └─ Domain
└─ Protocol

Absolute URLs

An absolute URL contains the full address — protocol, domain, and path:

<a href="https://example.com/about">About</a>
<img src="https://cdn.example.com/logo.png" alt="Logo">

<!-- Absolute URLs work from anywhere -->
<!-- Use for: external sites, CDN resources, canonical tags -->

All lessons in this course

  1. The anchor Element and href Attribute
  2. Absolute vs Relative URLs
  3. Opening Links in New Tabs and Download Attribute
  4. Linking to Sections Fragment Identifiers
← Back to HTML Academy