HTML HTML Basics Images, Text and Links Understanding File Paths

Victor Mercier
Victor Mercier
Treehouse Moderator 13,584 Points

File path ../

Hi, is there someone that is able to explain me the purpose of the ../? I very confused about it! Thank you in advance!

Louise St. Germain
Louise St. Germain
19,397 Points

That means to go up one folder in the folder structure. This is relative to the current file.

If the document you're linking to is in the same folder, you'd simply use <a href = "file_name.html">xyz</a>. If it's in a subfolder (a folder below) your current location, you'd use <a href = "subfolder_name/file_name.html">xyz</a>. But here it's in the folder above so you'd use <a href = "../file_name.html">xyz</a>. (You don't even need to specify the folder name - since it already knows which folder is above yours!)

That way you can avoid having to put an entire absolute path in there.

1 Answer

Nils Kriedner
Nils Kriedner
Front End Web Development Techdegree Student 22,815 Points

Hi Sebastien,

the two dots ".." are used to to say "go one folder out of the current folder".

So for example if you have two folders, one with "articles" (with html files of articles) and one with "images" (with image files) and you want to link to an image file from one of the articles then you need to go out of the "articles" folder and then enter the "image" folder like this: "../images/picture-name.jpg"

Does that make sense to you?

Happy coding!