Image tag doesn't display an image

+4 votes
This doesn't work <img src="photo.jpg" />

All I get is an empty square

Image file is definatelly there.
asked Jul 5, 2017 by John H (120 points)

1 Answer

+4 votes

Could you please tell me the location of the image file? Is it inside a folder or is it in the same folder as your html file?

The solution:

Image file was in sentence case, meaning the first letter was capitalised and thus the actual file name and the file name in the code didn't match.

A good practice is to keep all of your file names and html code as lowercase. Should help avoid issues such as this one.

answered Jul 5, 2017 by Lovecode (640 points)
edited Jul 5, 2017 by Lovecode
index.html is inside the website project folder, and the image is inside images folder which is also inside the website project folder
Is the file name of the image identical to the image file name you have inside the img tag?
Ah right, the file name was Photo.jpeg, so I renamed it to photo.jpg and now it works! Thanks!!
Lovecode logo