Archive with files here enter image description here I wanted to put the background in the header but for some reason Background-image does not work, the path I specified correctly tried the background in the same folder as the CSS with HTML. But nothing works

CSS: header{ background:url(images/header-bg.jpg); center center no-repeat; color:#fff; text-align:center; background-size:cover; 

I do not know what to do

  • one
    It is not necessary to place the code picture, make it text and formatting it into the code. - Stanislav Belichenko
  • 100% you made a mistake on the way to the picture. Find it in the code inspector, and look at the real path where it should lie - Crantisz

1 answer 1

You wrote parameters outside the background:url(images/header-bg.jpg); center center no-repeat; style background:url(images/header-bg.jpg); center center no-repeat; background:url(images/header-bg.jpg); center center no-repeat; Correct so

 background:url(images/header-bg.jpg) no-repeat center center; color:#fff; text-align:center; background-size:cover; 

After viewing your file, the cause of the problems is immediately visible, you wrote the styles without closing the commenting line! you have written in css

 /* --------------- /áàçîâûå íàñòðîéêè -------- background:url(images/header-bg.jpg) no-repeat center center; color:#fff; text-align:center; background-size:cover; 

you didn’t close the comment */ should be like this /* --------------- /áàçîâûå íàñòðîéêè --------*/ and didn’t write styles to which element, so

 header{ background:url(images/header-bg.jpg) no-repeat center center; color:#fff; text-align:center; background-size:cover; } 

be careful!

  • It did not help, I tried again to check the correctness of the path. It seems to be not mistaken - Artem Kyprianov
  • "It seems to be not mistaken" - this is scary)) if possible, give a link to the site to check, and by what method do you check the correctness of the path for the image? - Arsen
  • @ArtemKyprianov, without looking at the real code, either on your web server or in the archive, you offer to play “guess the melody” on two notes :) - Stanislav Belichenko
  • This resource is not possible to upload files !! You should post your code either in the editor or use another online resource where you can insert html + css + images of your project and give us a link to check. - Arsen
  • Already added the archive, sorry for the stupid questions, I'm still learning). If the archive does not fit, I can upload the code and the files to it - Artem Kyprianov