CSS Background Image Not Displaying

后端 未结 15 2083
[愿得一人]
[愿得一人] 2020-12-16 09:20

I have an HTML file with a subdirectory called img with an image called debut_dark.png. In my CSS file, I have:

body { 
    backgro         


        
15条回答
  •  臣服心动
    2020-12-16 10:13

    You have to use a relative path in the URL. I think you made two folders in the root directory where your index.html resides. One is 'CSS' folder & another is 'img' folder.

    Now, if you have to access 'img' folder in css files. So you have to go back once in root directory using "../" syntax. Then move to the 'img' folder using "../img" syntax. Then write the image name "../img/debut_dark.png".

    body { 
        background: url("../img/debut_dark.png") repeat 0 0;
    }
    

提交回复
热议问题