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

image file path

hey i wanted to know when do we use ../ for reaching the file path.

FOR example let us consider we have a folder named img . So when will we use

../img.hi.jpg VS img/hi.jpg

I have also seen sometimes we use ../.. So i want to know in which cases do we use these

If the image is in the same folder as the file you are getting the image from, you can use just the image name then the type. For example: img.jpg or img.png

If the image is in another folder then the file you are getting the image from, you can use the backslash/ then the name and the type. For example: folderName/img.jpg or folderName/img.png

1 Answer

../ is used when you are trying to go 'up a level' from your current file

A good resource to check out that will allow you to play with this idea is: https://www.w3schools.com/html/html_filepaths.asp

It is all based on your current file's position relative to your image's position in your folder hierarchy.