Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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
218,639 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 :)