My body tag is completely covered by the image. enter image description here

but when I change the screen size of the browser, the image does not cover the whole screen enter image description here

Here is the CSS code:

/* Bordered form */ body{ background: url(images/4.jpg) no-repeat; -webkit-background-size: 100%; /* Safari 3.1+ и Chrome 4.0+ */ background-size: 100%; /* Современные браузеры */ max-width:100%; height:100%;; } 

  • And what should happen when the screen is larger than the image? - Stepan Kasyanenko
  • @stepanKasyanenko image should be 100% unbroken - Ivan Smirnov
  • 100% horizontal or vertical? And if it stretches more than its size, it will be distorted. - Stepan Kasyanenko

3 answers 3

 body { background: url(https://picsum.photos/1920/1080) no-repeat center center fixed; background-size: cover; } 

    CSS background-size property

     background-size: cover; 
    • nothing helps, nothing has changed - Ivan Smirnov

    set the height in vh and the width vw.

     height: 100vh; width: 100vw;