Background image position

I have a background image whose size is larger than container i want to fit the background image in the container so that the image shoud not be stretched or cut . I am trying to use background position by giving values in percentage but that is not helping what should i do
3 Replies
snxxwyy
snxxwyy15mo ago
@.talhamustafa on your container you would do-
background-image: url("path or link to image here");
background-size: cover;
background-image: url("path or link to image here");
background-size: cover;
The background-size: cover; property allows the image to fit in the container without stretching. You can then use background-position to see the parts of the image you need to.
Moni
Moni15mo ago
I am doing exactly same but some parts of image is showing
Jochem
Jochem15mo ago
share your code then, otherwise people are just guessing in the dark. Something like codepen would be best, or hosted on something like github pages #how-to-ask-good-questions
Want results from more Discord servers?
Add your server