Why can't the background-image written in css find the background?

.body {

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

}

I have tried the following
background-image:url ("1.jpg");
background-image:url ("/ image/1.jpg");
background-image:url (".. / image/1.jpg");
background-image:url (".. /.. / image/1.jpg");
even tried this
< body class= "body" >
but still got
net::ERR_FILE_NOT_FOUND

.
Feb.28,2021

I tried https://github.com/xiaoyueyue.. It must be the wrong path. What is your path?


A screenshot of your picture and file directory shows that mine is OK

clipboard.png


if the path is correct, there should be no problem W3C background-image document try
Please paste screenshots of pictures and file directories


Open the console to check.
check whether the path is correct, and make sure that the picture has a width and height. Note that the width and height will take effect after the background-image attribute. Try the
plus background-size < / height > attribute.


my solution is to add a background image directly to < body > in html


net::ERR_FILE_NOT_FOUND file can not be found, it should be a path problem. Secondly, there is an extra "." in front of body. Are you sure you want to name a class with body

?
Menu