Home > front end >  CSS background image won't show up
CSS background image won't show up

Time:04-17

So my header image shows up when I open Chrome from my code editor (webstorm) but after I close webstorm and open index.html manually from my project folder, the header image won't load/show up, background-image: url("/assets/heroimage.jpg"); any idea why? Same problem on github when I host my website

Thanks

CodePudding user response:

Have you tried with a "relative path" adding a point at the start?

background-image: url("./assets/heroimage.jpg");

CodePudding user response:

as mentioned Here the problem is with how you linking the image to the CSS.

Try removing double quotes and removing unnecessary backslash: background-image: url(assets/heroimage.jpg); or background-image: url(./assets/heroimage.jpg);

Hope it helps :)

  •  Tags:  
  • css
  • Related