I tried to change background image of div based on the image i clicked, and while that work, the css for background-size:cover
and background-position:center
didn’t work and my images ended up looking like this
Any idea why?
I tried to change background image of div based on the image i clicked, and while that work, the css for background-size:cover
and background-position:center
didn’t work and my images ended up looking like this
Any idea why?
This is one.
background-position: center center;
still didn’t work man
I think it’s because i upload the background-image using javascript but idk
If you use JavaScript, you can add position in JavaScript like this:
document.body.style.backgroundPosition = "center center"
Thank you both it worked! I applied it to css first lol