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 HTML Objects Images

My images don't seem to work. Does the .jpg file need to be a certain size? My image I am trying to use is 1280x960

My image doesn't show when I use it. It is 1280x960. Is this to big? It shows in the workspace when I open it.

<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>My Page</title>
</head> <body>

<img src="DSCF1075.JPG">

</body> </html>

this is the code I have used. not sure why it won't work....just shows a box with an x in it when I display the page

8 Answers

fredy mendez
fredy mendez
5,886 Points

its probably because the path to to image is wrong, if your image is inside a folder. and your html page is not in the same folder as your image. then you have to do this <img src="image_folder/DSCF1075.JPG"> change the folder name,. also make sure that the name of the image is the same, also another thing that i notice is that you wrote the image name and extension in capital letters, try to change it to lower case.

ok I think I am confused here. I have tried having the image inside its own folder with the index.html. I have tried it outside the folder, nothing seems to work. I have tried the file name with lower case also...didn't make a difference. So you are saying that the image file and the index.html need to be in the same folder?

fredy mendez
fredy mendez
5,886 Points

it can be in any folder as long as you know the path to the image, but if you are confuse, for now just put the index.html and image in the same folder so you can to is like this <img src="DSCF1075.JPG"> assuming that the name of your image file in uppercase

well I just did what you said and it comes back with this now instead of the square box with the x in it...

../ images/

so I am giving up tonight...been a long day...lol

thanks for your help...maybe tomorrow I can get it to work right...

Thomas Seelbinder
PLUS
Thomas Seelbinder
Courses Plus Student 1,223 Points

It's going to be the path that you have it listed. <img src="img/imagefile.jpg>

Thanks everyone for all your help and insight! I have got it fixed and I can see my images! Thanks again!

edwin scott
edwin scott
6,043 Points

Could you please share what you did? I am having the same problem.

Thanks!

Katherine Pitre
Katherine Pitre
727 Points

I had this same problem where just a little picture of an image holder appeared on my index page instead of my picture of a galaxy. I fixed it by changing "galaxy.jpeg" to "galaxy.jpg" (jpeg to jpg). I'm not sure why that worked, but it did.

Elena Paraschiv
Elena Paraschiv
9,938 Points

how did u guys fix it? I am experiencing the same problem and the path is correct. is the same folder. relative

Elena Paraschiv
Elena Paraschiv
9,938 Points
<!DOCTYPE html>
<html lang="en">
<head>
 <meta charset="utf-8">
 <title>My page</title>
</head>
<body>

 <p>Home page</p>


<img src="flowers.jpeg">
</body>
</html>

i tried changing it with jpg. still doesn't work

When looking in the google console there appears to be an error. style="display:none". I think there lays the problem, but I don't know how to change it

fredy mendez
fredy mendez
5,886 Points

Are you putting the right path to your images? or can you show your code to see what is the problem?

Elena Paraschiv
Elena Paraschiv
9,938 Points

thaks Fredy. I added the code in the comment above