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

don't understand image paths

Hello,

I’m a beginner and I’m working on building a simple website, I’m having trouble with a code challenge.

I put in what I think the image path is, but it says it’s wrong. Could someone please explain how paths work regarding images. Thanks, Gerard.

3 Answers

There are absolute and relative paths.

Absolute paths are the entire link, not flexible though so not recomended to use all the time.

Relative paths use the root folder as home to write the link. Two periods in the URL go back on folder in your file structure. In a relative path you are writing your URL from the file you are in to the file or image you want within the root file structure.

Hello Kevin,

Thank you for your answer but I’m still struggling to implement the code into the body text of the code challenge.

I downloaded the folder “websitewaters-island01-stage01” and put it into the documents folder and tried the image “new-cupcake-caramel.jpg” but it didn’t work. Any idea where I can go from here? I feel so stupid I can’t figure this out. Thanks, Gerard.

Sounds like you are having file path issues. I recommend you check out tutorial on file paths

I haven't downloaded any of the docs before so I'm not sure, but try putting your code up in here so we can see. Are you trying to use absolute or relative links?

Hello James,

Yes I was having an issue with image paths, after reading the information you sent me I sorted it out now. Thanks for your help as well Kevin. Gerard.