Sample Website

This is Page 4




Absolute and Relative Links

The difference between absolute and relative links.

Absolute Links

An absolute link uses a path that leads to a source outside of your own directory.

For instance: You want to create a link to an image on someone elses website.

You would use something like:
<img src="https://www.somewebsite.com/images/picture.jpg">

This will work for some time, but problems can occur if or when that particular website no longer exists, or if the owner changes or moves that particular image.
Then you end up with a broken link (a link that points nowhere).

Example of absolute link:  puppy
With the link above, I have no control on how long it will remain working, since the link points to an image on a website that doesn't belong to me.




Relative Links

A relative link uses a path that leads to a source within your own directory.
The examples below assume there is an image named 'dog.jpg' in the root directory.

In the link below, dog.jpg is in the same directory.
<img src="dog.jpg">


Below, dog.jpg is in the same directory (same result as above).
<img src="./dog.jpg">


Below, dog.jpg is in the images folder of the same directory.
<img src="images/dog.jpg">


Below, dog.jpg is in the images folder, which is in the files folder.
<img src="files/images/dog.jpg">


Below, dog.jpg is in a folder one level up from current directory.
<img src="../dog.jpg">


Below, dog.jpg is in a folder two levels up from current directory.
<img src="../../dog.jpg">



• back to top •

Updates & Other Notes
(in descending order)


Update 5 - Mar 25th, 2023
Small changes here and there. Fixed some typos and other little things.

Update 4 - Nov 11, 2022
Uploading files to GitHub.

Update 3 - Oct 31, 2022
GitHub Pages? Yes you can absolutely use this for GitHub Pages. Short guide on how to do that on page 2.

Update 2 - Oct 30, 2022
At first, this was a 2 column layout, but because I had a lot of space on the right side (almost equal to left) I added a 3rd column here, which turned out for the better since I am actually using it now.

Update 1 - Oct 29, 2022
Eventually I will put any updates and other notes here, in descending order (most recent at top).