Foundations / Topic guide
Understand the address behind every link.
A URL identifies a resource. HTML gives that address a job: open a page, load an image, fetch a stylesheet, or embed another document. Start with the address itself, then choose the element that expresses what you want the browser to do.
HTML URLRead a URL in parts
The scheme describes the protocol, the hostname identifies the destination, and the path points to a resource within that site. A query can carry named values, while a fragment can identify a section inside the returned document. Keeping those jobs separate makes a link easier to review and maintain. A fragment is handled by the browser and is not part of the HTTP request sent to the server.
Choose the right kind of address
An absolute HTTP(S) URL includes its scheme and hostname. It is useful when the destination must remain unambiguous across websites, email messages, or feeds. A root-relative path resolves from the applicable base URL’s origin. A document-relative path resolves from that base’s directory. Without an HTML base override, the document address provides the base; adding a base element can change both references, including fragment-only links.
Keep the readable version stable
Pick a descriptive path and reuse it in navigation, article links, and sharing metadata. Use query parameters for a defined purpose instead of treating every variation as a new content page. Encode individual parameter values with a URL-aware API when constructing addresses programmatically. Escaping an ampersand as & in HTML source and percent-encoding a URL value solve different problems.
<a href="/blog/html-url-basics/#conclusion">
Review the URL essentials
</a>Reference: MDN: What is a URL?. Examples and review steps above are practical editorial guidance.
Go deeper in the Lab
HTML URLs explained: paths, parameters, and fragments
Read a URL with confidence, choose reliable paths, and build links that survive changes to your site.
Read the full article · 7 minGood questions make better links.
Have a correction, a question, or a topic for the Lab?