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

Broken

Hi Guys,

I am new to this and I just finished the HTML classes. I am not sure why but I coded exactly how it showed on the video but all my images when viewed on chrome or even in safari they appear as broken. I am putting in the right folder name as well. Everything else looks fine but the images always come out broken. Does anyone know what I am doing wrong or what I can do differently?

If you can post your code on here we will be in a better position to help you.

5 Answers

Sounds like you've got a file path issue with your images.

The way it works is that you have to put your images in the correct folder relative, to your HTML file.

Here's an example:

file directory structure example

Does that help?

If not, you can read up about absolute vs relative paths

I had the same problem. I think I fixed it when I pulled the "img folder" from out of the downloaded project zip files and saved it by itself into the same folder I saved the "index.html" project.

I'm not 100% clear on what you are describing that you did.

Are your images in their own folder or in the same folder as your html?

If so ...

As your website grows you'll want to organize your images, CSS & HTML into separate folders. Here's a tutorial where you can read more about how to organize your files

I wasn't 100% clear on what I did to get it to work. If I was more organized to begin with, I wouldn't have been as confused. Thanks, your answer has helped.

It was a path issue. Your answers helped. Thank you! I created a different folder and put the img folder along with the index.html in there and it worked! I guess I will need to be more organized moving forward.

You really want to keep the index.html file in the root folder e.g. the main folder. Then have a img folder inside your root folder too, that contains your images.