CSS root directory

前端 未结 6 1482
小鲜肉
小鲜肉 2020-12-13 00:01

I have a style sheet where I include background images.

background: url(../Images/myImage.png);

problem is, pages from different directorie

6条回答
  •  我在风中等你
    2020-12-13 00:35

    For example your directory is like this:

    Desktop >
            ProjectFolder >
                          index.html
                          css >
                              style.css
                          images >
                                 img.png
    

    You are at your style.css and you want to use img.png as a background-image, use this:

    url("../images/img.png")
    

    Works for me!

提交回复
热议问题