Welcome to the Treehouse Community
Looking to learn something new?
What have I done wrong with my images?
I am working through the web design track, and am having issues with adding images to my portfolio site we are building. Nick's site has his images, but mine only shows an x in the browser and in dreamweaver.. Any ideas?
I can see the photos in my computer before I added them to the workspace..
August Fagelberg2,080 Points
You have to supply a image path dependent on the file you're editing. Let's say your directory structure looks like this:
|-- images |-- my-image.jpg |-- portfolio |-- my-portfolio.html | index.html
When you're in your root index.html file, you will have to type:
<img src="images/my-image.jpg" alt="A picture of an image">
But when you're in my-portfolio.html in the sub-folder portfolio, you will have to type...
<img src="../images/my-image.jpg" alt="A picture of an image">
... to achieve the same result. This basically tells HTML to go one folder back and then go look in the folder images for the image my-image.jpg
Do you have the src attribute pointing to the right location? When I have this problem, I have usually forgotten to include the folder name.
I think the folder in the portfolio project is "img", so it would look something like this:
<img src="img/my_image.jpg" alt="My image">