Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Selecting a parent directory in html

I have a general question (I'm not all to familiar with html).

The following use of the slash I have discovered points to a sub-directory, in this case for Images:

/Image/my_Image.png 

Is there an html equivalent for pointing to a parent directory?

like image 428
Falcon Avatar asked Nov 14 '13 12:11

Falcon


People also ask

How do you go up a directory in HTML?

Starting with / returns to the root directory and starts there. Starting with ../ moves one directory backward and starts there. Starting with ../../ moves two directories backward and starts there (and so on...) To move forward, just start with the first sub directory and keep moving forward.

What is the symbol for parent directory?

.. (double-dot) is the parent of your current directory. ~ (tilde) is your home directory. / (slash) if it present at first character, it usually is called root directory.


2 Answers

../ will give you one level higher parent directory. You can use as much as you want to go higher level parents like ../../

../Image/my_Image.png  

will be Image folder in parent directory

like image 125
Kuzgun Avatar answered Sep 28 '22 10:09

Kuzgun


Single dot = current directory, double dot is parent directory...

./ = current ../ = parent 

So let's say you have a style rule for an image in a CSS file called "styles.css".

  • The location of the stylesheet is C:\MyApp\CSS\styles.css.
  • The location of the image is: C:\MyApp\Image\my_Image.png.

When the CSS is being read, it will be the location of that css file that's used for the current location. So if you want to get to your image, you can point it like this:

background: url("../Image/my_Image.png") no-repeat scroll 0 0 transparent; 

If the location of the image would have been directly on C:\, you would have to go back two parent directories:

background: url("../../my_Image.png") no-repeat scroll 0 0 transparent; 

This principle also goes for JavaScript files and so on.

like image 41
Lave Loos Avatar answered Sep 28 '22 10:09

Lave Loos