ozil
ozil

Reputation: 7117

Difference between "../" and "~/" relative path

I am storing style sheets in {root}/styles while images in {root}/images for a website.

  1. what is difference between ../ and ~/. ?

Upvotes: 0

Views: 143

Answers (4)

Tushar Gupta
Tushar Gupta

Reputation: 15923

Depends on the framework you are working on.If you have ASP.NET context ~/with ResolveUrl refers to the root level directory, ignoring the sub directories as well.

In CSS we navigate to the previous directories using ../. If you use ../../ you navigate to two steps back and so on.If you use ./, you can reach to the root

Upvotes: 0

x13
x13

Reputation: 2227

../ goes up one dir from the current dir.

~/ goes to the dir where you originally came from (not usable in html).

Upvotes: 0

Quentin
Quentin

Reputation: 943579

../ references the parent directory.

~/ has no special meaning in standard URLs. It does have special meaning in

  • ASP.NET where it references the root of the application
  • UNIX shells where it references the current user's home directory

Upvotes: 6

Curtis
Curtis

Reputation: 103348

../ is relative to the current path of the file.

~/ is relative to the root of the application (in ASP.NET).

Upvotes: 2

Related Questions