Hello, for some reason, the background-image property does not work. Tell me, please, what is wrong? Maybe something overlooked? Thank you in advance. enter image description here

enter image description here

  • do not show code with screenshots. - Volodymyr
  • Add code to the body of the question as a text, not an image. To do this, use the edit link located below the labels. - Nicolas Chabanovsky

2 answers 2

In the stylesheet file, the paths are relative to the location of this file itself. Thus, the browser requests the background from the css/img/fitness.png . To verify this, go to the developer tools, open the requests section and refresh the page. In the image request there will be an error 404 and the path that the attempt was made to get this file will be indicated. To fix this, set the background path so ../img/fitness.png ( I assumed that the img folder is in the same directory as the styles folder. Consider this point if my assumption is not correct ).

  • Thank you, you were right - Lebowski

Add quotes in the string:

 background-image: url("img/fitness.png"); 

Also, make sure the path to the file is correct.


If it did not work, then, most likely, in the rows of the index.html file

 ... <div class="section section_blue"> <div class="container"> ... 

your container block closes the contents of the section_blue block, and the picture is not visible. To fix this, try to combine these two blocks.