Skip to Content
Web Design in a Nutshell, 3rd Edition
book

Web Design in a Nutshell, 3rd Edition

by Jennifer Robbins
February 2006
Intermediate to advanced
826 pages
63h 42m
English
O'Reilly Media, Inc.
Content preview from Web Design in a Nutshell, 3rd Edition

Relative URLs

A relative URL provides a pointer to another document relative to the location of the current document. The syntax is based on pathname structures in the Unix operating system, which are discussed in Chapter 4. When pointing to another document within your own site (on the same server), it is common to use relative URLs.

For example, if I am currently in resume.html (identified here by its full pathname):

www.littlechair.com/web/work/resume.html

and I want to put a link on that page to a document named bio.html that is in the same directory:

www.littlechair.com/web/work/bio.html

I could use a relative URL as the href attribute value as follows:

<a href="bio.html">...</a>

Using the same example, to link to the file index.html in a higher-level directory (web), I could use the relative pathname to that file as shown:

<a href="../index.html">

This relative URL is the equivalent to the absolute URL http://www.littlechair.com/web/index.html.

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Beginning Responsive Web Design with HTML5 and CSS3

Beginning Responsive Web Design with HTML5 and CSS3

Jonathan Fielding

Publisher Resources

ISBN: 0596009879Errata Page