Document relative links

Suppose you have a file structure which looks like this:

file map

[In this diagram folders are shown in italics and files in normal type. ]

To create a link from 'index.html' to 'elephant.html' the code would be:

<a href="animals/elephant.html>Go to the elephant page</a>

To go from 'index.html' to 'cat.html' the code would be:

<a href="animals/pets/cat.html>Go to the cat page</a>

From 'elephant.html' to 'tiger.html':

<a href="tiger.html>Go to the tiger page</a> (because they're both on the same level)

From 'elephant.html' to 'cat.html':

<a href="pets/cat.html>Go to the cat page</a>

From 'elephant.html' to 'index.html':

<a href="../index.html>Go to the home page</a> '..' means "go up one level"

From 'cat.html' to 'index.html':

<a href="../../index.html>Go to the home page</a> '../..' means "go up two levels"

Can you work out:

  1. How to go from 'cat'html' to 'dog.html'?
  2. How to go from 'dog.html' to 'tiger.html' ?