1

Background image is not showing because of image path problem.

css code

background-image: url("images/menu_home_icon.png");

My actual image path is EZ_MOVERS/images/menu_home_icon.png.

But it shows EZ_MOVERS/css/images/menu_home_icon.png while I checking through Inspect Element.

I can't find from where /css comes.

Anybody help please ?

Ahtisham
  • 7,516
  • 4
  • 36
  • 49
Arafat Rahman
  • 885
  • 4
  • 12
  • 37

1 Answers1

3

Probably because the stylesheet is located in the /css folder. Remember that the paths in the file are relative to the stylesheet's path. Based on my understanding, your directory structure looks a little like this:

EZ_MOVERS
 │
 ├── css
 │    └── <stylesheet>.css 
 └── images
      └── menu_home_icon.png

So if you want to traverse a directory up and then select the /images sibling folder, use ../images/menu_home_icon.png.

Terry
  • 57,476
  • 13
  • 82
  • 106