Reputation: 2179
I've set my background image (1280 x 853) and that doesn't suit well the screen.
How can I fix that?
body {
background-image: url("/assets/pic.jpg");
}
Upvotes: 0
Views: 1021
Reputation: 722
In addition to background-size: cover, you can use the background-position property to place your image where you want it to be, as sometimes background-size:cover will cut off areas that you wanted to be visible. Using percentage values in the background-position property will allow you to fine tune this more.
Upvotes: 1
Reputation: 4821
body {
background-image: url("/assets/pic.jpg");
background-size: cover;
background-repeat: no-repeat;
}
Upvotes: 3
Reputation: 3213
You can use:
body {
background-image: url("/assets/pic.jpg");
background-size: cover;
}
And optionally set background-repeat: no-repeat
to prevent to image from repeating.
Upvotes: 4