Absolute VS Relative Links


 


I had a student need clarification on absolute and relative links.  Here is part of the email that I sent him.  Hope it helps.

There are two types of links. One is called absolute and the other - relative. But to understand them, you first need to think about how things are structured. 

There is your local directory and then there is everything else. What is in your local directory is 'relative' or think of if this way ... related to your home directory ... just like family.  Your wife is relative to your household, along with the new child (will be). When you relate to them, you do not call them Mary (sorry, don't know their first names) Smith and Ted Smith Jr (okay ... that was an
assumption). Instead you call them Mary and Jr because they are relative to your house, surroundings, etc.

It is the same regarding your files. If you are thinking about a file on your home directory ... you don't think www.cs.iupui.edu/~smith/resume.html. Instead you think resume.html.  Make since??

That's relative.

Now, absolute is everyone or everything else. If you are at home, sitting around the table and talking about someone called Mary ... those sitting around with you may think it is your wife. Instead, you are talking about the woman on the third floor in the hospital who will be keeping you posted on the progress of the upcoming delivery. So, to help clarify ... you call her Mary Poppins of Mercy Hospital. In a way it is an address with a name attached.

Same way with html docs. If you want to refer to my resume.html within the lburrow directory  ... then to simply use a relative link to resume.html will not take you to my resume, but to yours ...  Instead, the link is http://www.cs.iupui.edu/~lburrow/cs241/resume.html

Make since ...?

So the basic syntax??

Relative:
<a href="readme.txt">

Absolute:
<a href="http://www.cs.iupui.edu/~lburrow/cs241/resume.html">




Copyright © 2000 - Indiana University Purdue University - Indianapolis