0

So i've been trying to make my div's background be an image lots of times. And It has worked. However I have started to organise my files and it stopped working?

I want to use an image from my "Images" file and use it in my "style.css" file which is in my "stylesheets" folder. I've used the following code, but it doesn't work?

Some CSS:

.header {
    background-image: url("/images/SummitHome1.jpg");
    width: 100%; height: 800px;
    background-repeat: no-repeat;
    padding-top: 5px;
    background-size: cover;
}

Ps: heres a pic of my files

here are my files (if it helps)

Baha
  • 67
  • 6
  • Use relative paths - especially if not on a web server. From the parallel stylesheets folder to images folder: `background-image: url("../images/SummitHome1.jpg");`. From anywhere to images `background-image: url("/images/SummitHome1.jpg");` assuming images is in the root directory – mplungjan Jan 01 '22 at 14:53
  • url() is relative to the .css file. So in this case you need to go back 1 directory. – Kay Jan 01 '22 at 14:54
  • Hey mplungjan, I have tried "background-image: url("../images/SummitHome1.jpg");" but it's not working still? I have a domain name linked up "https://www.summ.ga", has that changed anything? – Baha Jan 01 '22 at 15:34

0 Answers0