Calling an Image from CSS

  • My .html files are in Assignment1/*.htmlfiles
  • My CSS file is in Assignment1/style/cssfile.css
  • My images are in Assignment1/images/images.png

How to call an image from Assignment1/style/cssfile.cssto a Assignment1/images/images.pngfile?

I cannot do this as html files, since I can just forward folders to go through. I am trying to do:

.top {background-image: url("Assignment1/images/deco1400.png");}

from the css file to no avail.

How can I link to my image files from my CSS, which are in different directories.

+3
source share
1 answer

to try

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

Your tree structure is like

Assignment1
  style
    style.css <- you are here
  images
    img1.png

1 (..), /images/img 1.png( / ). , Assignment

UPDATE: .

+5

All Articles