Images won't show up on my website?

December 16, 2014 3.3k views

I have my images in the same folder as my html files, and in the css it’s formatted as background-image: url(“sun.JPG”) ;

But for some reason it won’t load on my website?

Any help?

2 Answers

Somehow it started working, think it was because I didnt update the css file properly and it still had the filename as sun.jpg instead of sun.JPG

  • Oh, yes, most linux filesystems (including the one that DigitalOcean images use) are case-sensitive so you’ll have to make sure that the file name in the CSS file is exactly the same as the file itself. Happy to hear that it’s working now! :)

  • Thanks for pointing this out! It fixed my problem.

    Somehow my files had a .JPG (capitalized) type and I referenced them as .jpg (lowercase). Once I made them the same it worked fine. Thanks!

The URL is relative to the location of the CSS file. Are the images stored in the same directory as your CSS files? If not, you’ll have to either change the path to e.g. ../sun.JPG or move the images to the same directory as the CSS files.

Have another answer? Share your knowledge.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!