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

Creating an image element

I am having issues adding the image element to the website for the HTML course. After I added the image element <img src="img/logo.gif" alt="Smells Like Bakin"> in between the body tag, I noticed that the image is broken on my index page, after I refreshed. Is there something wrong the the image file?

6 Answers

Carlos Perez
Carlos Perez
5,939 Points

It depends where the img folder is in the document hierachy: try: html <img src"../img/logo.gif" alt="Smells Like Bakin"/>

and read up on relative and absolute paths in the directories. ;)

I typed the source exactly how it is located in the directory. img/logo.gif. Its in the "img" folder and the file name is "logo.gif. I tried your element and the image did not show up on my page after I refreshed.

Carlos Perez
Carlos Perez
5,939 Points

Is your img folder in the same path as your index.html file??

karen reyes
karen reyes
2,587 Points

What Carlos Perez means is that all of the files that you download from Treehouse AND your index.html file must be located in the same folder. You will learn about this (file paths and relative vs. absolute links) in the HTML beginner courses.

(ps- not sure why Carlos Perez made his first suggestion without knowing where your files are located)

good luck!

Carlos Perez
Carlos Perez
5,939 Points

Karen Reyes because regardless where her img files would be my suggestion would of shown the img. ;)

Yeah maybe I should have taken the beginner courses before jumping into it since I am new to the world of coding. The path for my image: Smells Like Bakin > websitewaters-island01-stage02 > img > logo.gif