HTML HTML Basics Going Further with HTML Root-relative Paths

CJ Ruacho
CJ Ruacho
1,309 Points

i dont understand why using "/" works the same as ../

if ../ and / is the same then why learn both also im a beginner and all i know is to use workspace on hear and and it lets me view my code on the website i open when i push the eye thing. so as much detail would be great

2 Answers

Steven Parker
Steven Parker
177,563 Points

Those act the same only if you're already in the root directory, or in a subdirectory of the root. That's because the ".." part refers to the parent directory, and in the root folder there is no parent so it refers to itself.

If you were in a more deeply nested directory, they would not do the same thing.

Waqar Hussain
Waqar Hussain
3,797 Points

So the "../" refers to one folder jump. So no matter what type of system you're using, it'll always jump one folder back.

While the single backslash "/" refers to the root directory. So if your file i.e. the index.html is in root directory, you can directly call it via the single backslash or you can jump the number of folders as is required to get to the root.

Hope this answers the question :)