Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

HTML

James Coffin
James Coffin
238 Points

img tag question

Hello, I put the "smells like bakin'" folder on my computer. However when I put in the image tag <img src="../desktop/img/logo.gif" alt="Smells Like Bakin"> like this, the text editor asks for 2 dots in front of desktop in order for the tag to work. My question is what do those dots mean? Is that normal syntax? I tried this with multiple text editors and it's the same with all of them.

2 Answers

Ilja Daderko
Ilja Daderko
8,953 Points

The "../" means that you are jumping out of a folder to grab something for example if your web project is in a folder named "Project" and inside this folder you have "img" "css" "files" folders, We can assume that your html page is inside files folder. In order to get an image you will need to jump out of a "files" folder to get access to "img" folder (as it is outside), so in your html a path to an image should look like "../img/somefile.png" It sounds to me like you might be doing something wrong, as you should not encounter this problem, make sure to watch through videos again.

James Barnett
James Barnett
39,199 Points

Ilja Daderko -

:+1: Nice explanation of how relative paths work

James Coffin
James Coffin
238 Points

Thank you very much. That helped a lot!!