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!
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
Abby Roe1,690 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?
Steven Parker228,001 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.