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

CSS How to Make a Website Adding Pages to a Website Add Iconography

i did't understand what he meant by the 2 dots? thanks :)

..

2 Answers

Keith Kelly
Keith Kelly
21,326 Points

The two dots are a part of a relative path. In the example the css file Nick is working on is contained in the css folder. If he would enter the path to the image being used without the two dots the program would start in the css file's directory then attempt to find the image file from there. So with out the two dots it would look for 'css/img/phone.png'.

When you are adding two dots you are telling the program to move up one directory and then find the img folder.

Hopefully that makes sense :)

David Clausen
David Clausen
11,403 Points

.. is just a code for going backwards in a relative path. Imagine your at the C: drive and go into User folder and, so it be C:\User, inside user you create a folder called CSS with a mystyle.css in it. So you have C:\User\CSS\mystyle.css.

Well if you want reference let say an image folder in C:\User\image in your mystyle.css and you put src('image\myimage.jpg') the full path is "C:\User\CSS\image\myimage.jpg", which is not correct. So you need to go back one, thats what .. does, so src('..\image\myimage.jpg') is translated to C:\User\CSS\Image\myimage.jpg, this works as much as you need it to go back. Need to go back to C drive? src(.....\image\myimage.jpg) would be C:\image\myimage.jpg, we went back to C drive then into another folder.

Hope that helps!