user770022 user770022 - 3 months ago 9
HTML Question

How do I put a hyperlink to "two levels above in the directory tree"?

I am trying to code my Home button. Is there a way to just climb back up the file structure, instead of using the absolute path like I have below.

I have a file index.html that I have at

C:\Users\Randy\Documents\XML\


Heres my code:

<a id="my-family" href="C:\Users\Randy\Documents\XML\index.html">Home</a>


Heres where I am trying to come from:
C:\Users\Randy\Documents\XML\project\xml

Shi Shi
Answer

You can use ../index.html to refer to index.html in the parent directory.