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

General Discussion

What does ../ represent?

I've look everywhere on other websites and I couldn't find the meaning behind it. It took me 1 hour to fix this problem by which I had to put up a wallpaper.

Original

           background-image:url('Background/Wallpaper.jpg');

Fixed

background-image:url('../Background/Wallpaper.jpg');```



I understand why I need to have a dash between Background/Wallpaper because it's in a folder (logic I can follow). But I don't like to leave things behind that I don't understand. I have a feeling ../ represents some type of level. I'm already telling the markup language, the file is in the background folder and the file name is Wallpaper.jpg. What more could it want from me?

4 Answers

Dave McFarland
STAFF
Dave McFarland
Treehouse Teacher

The ../ means go up one level in the directory. In other words, the file isn't in the same directory as the web page (or CSS file), it's one level up.

./ is a path that refers to the current directory and ../ is a path that refers to one level up in the directory tree.

For more info check out this quick remind about file paths from CSS Tricks.

Why did they make everything so confusing? OK, I understand what you guys are saying. A way of telling the computer that the source is located on a different level.

However, if I'm adding an image I don't use the ../ .

I just have to use a dash: Folder/Image. Why are they torturing us this way? The outcome is the same! Find the folder, and then where the image source is! Ugh!

I'm not entirely sure what you are asking here ...

.... so, I'd suggest you read up about how to organize your files and how file paths work ...

... then post any questions you've still got to this thread.

Thanks for the links. I just wanted to know in CSS why for image { you only type Folder/Flower] but for a background you have to type ul (../Folder/Flower)

You wouldn't that's not how CSS works. Paths as I describe them work the same no matter what CSS property you are using.

Post your code and the directory structure of the files, if you have a specific example where you are confused why a certain path was used.