What is the difference between "~ /" and "../" for directory browsing?

1

I saw this somewhere, wanted to know the difference.

    
asked by anonymous 06.02.2015 / 02:30

1 answer

1

Hi, come on, / references the root of the OS directory (Unix architecture, in this case, via console), only / accesses the root of your project, and ../ the above level , see this practical example:

Imagine that you are creating a web application and have the following folder structure:

css
    style.css
    reset.css
images
    logo.png
    sprite.png
javascript
    main.js
    jquery.js
index.htm
about.htm

Now you want to format the "logo" class, where, such class will have the file logo.png (which is in the images folder) as the background image. Such a class will be part of the style.css file, it would look like this:

.logotipo {
        background: url('../images/logo.png');
}

Finally, the style.css file is in the css folder, and to access the images folder it is necessary to go back one level (so we use '../'), and after that access the folder with the logo, was it clear?

I hope to have helped, hugs.

    
06.02.2015 / 02:45