Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 247
user770022 Avatar asked Aug 13 '11 16:08

user770022


1 Answers

to go two level up use "../../" and your normal url from two level up folder.

"../" in the path is used to go one level up. But, it can be used for more times, to go more levels up.

an example:

| HOME <br> 
+- image.jpg<br> 
|_
  |
  +- CONFIG<br>  
     |
     + PICTURE_CONFIG
       | 
       +- myfile.html

myfile.html contains:

<img src="../../image.jpg" />

the second"../" goes from PICTURE_CONFIG to CONFIG folder
the first "../"goes from CONFIG to HOME folder
"image.jpg" searches in HOME folder for the file "image.jpg"

like image 179
Tudor Avatar answered Oct 21 '22 05:10

Tudor