Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

HTML HTML Basics Going Further with HTML Root-relative Paths

CJ Ruacho
CJ Ruacho
1,321 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
228,991 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
5,236 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 :)