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

Abby Roe
Abby Roe
6,375 Points

Photo files not working when page loaded from files

I am on the 'Working on a Website Project Locally' video in the HTML Basics course, Web Design track, and found some trouble. When I open my web page from files, the images on my page aren't shown, while if I open my web page via the Treehouse Workspace, the images load fine.

When I try to go to the article.html page from the web page opened from files, it gives me an error saying that my file couldn't be accessed. I tried to troubleshoot but couldn't figure out how to fix it. What should I do?

Thanks!

1 Answer

Steven Parker
Steven Parker
231,269 Points

When working on a site from both a server and local files, it's important to make all resource references (href values) be relative. (so not starting with "http://"). Then, you must be careful to replicate the folder arrangement in both places.

So, for example, if you have a reference like img/photo.jpg that works on the server, you must have an "img" folder inside the folder where you local page is, and the "photo.jpg" file must be inside that "img" folder.

Abby Roe
Abby Roe
6,375 Points

Thank you for your advice! I went and double-checked everything, and I realized that I didn't unzip the file. In the video, it didn't say anything about unzipping the file, only to click on it to open it.

Thanks again!