3

CSS:

    body{
      background-image:url("img-address");
    }

I want the image not to repeat itself multiple times, but to span the entire screen. I don't want to use a normal image I want to use background-image.

Johannes
  • 64,305
  • 18
  • 73
  • 130
Brandaboss
  • 37
  • 1
  • 1
  • 6

4 Answers4

4

you can use background-size:

https://www.w3schools.com/cssref/css3_pr_background-size.asp

body {
  background-size: 100% 100% ;
}

or

body {
  background-size: cover;
}
Taki
  • 17,320
  • 4
  • 26
  • 47
2

Use background-repeat: none and background-size: cover

Johannes
  • 64,305
  • 18
  • 73
  • 130
1

Try to use background-size: cover; as described in this article: https://css-tricks.com/perfect-full-page-background-image/

It will make the image stretch to fill the available space and scale accordingly to the size of its container.

Let me know how it goes :)

Adriano
  • 3,788
  • 5
  • 32
  • 53
1

You can use the following to make it fit:

background-size:cover; Resize the background image to cover the entire container, even if it has to stretch the image or cut a little bit off one of the edges

background-size:contain; Resize the background image to make sure the image is fully visible

So it does not repeat: background-repeat: no-repeat;

https://www.w3schools.com/cssref/css3_pr_background-size.asp