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 trialLeslie Do
1,471 PointsWhat are the differences between root-relative, relative and absolute paths? Please list examples.
Hi everyone! I am having a hard time with understanding the differences between root-relative, relative and absolute paths. What are examples of each one and how do you differentiate between each file path? I still do not understand the difference between absolute paths and root-relative paths. Which website or article has an in-depth, clear explanation (with contexts) of each file path.
Also, I am not sure what going up a directory means when writing a file path in HTML. Can someone explain to me the process and why we need to write "../" when we go up a directory? Is this an example of a root-relative file path?
Thanks in advance for your time and review of my questions. I deeply appreciate your patience.
1 Answer
Steven Parker
231,198 PointsThe phrase "going up" means traversing to the parent directory of the current one. Here's some examples:
- "img/sky.jpg" relative path
- "../photos/star.jpg" relative path that "goes up" a folder and then down into another
- "/js/app.js" root-relative path (starts with /)
- "http://www.ebay.com" absolute path (full URL)