Within a container, I have an image set up like this:
.container {
height: auto;
width: 100vw;
position: relative;
overflow: hidden;
}
img {
width: 100%;
min-width: 500px;
object-fit: cover;
object-position: 50% 50%;
}
<div class="container">
<img src="https://s.tmimgcdn.com/blog/wp-content/uploads/2016/04/1-9-2.jpg?x47994" alt="">
</div>
The image adjusts within the container based on screen size but I want it to always be centered using object-fit and object-position properties.
In my current setup, the object-position property does not respond to percentage values, only pixels.
EDIT: Can someone explain why object-position doesn't work with percentages in my example?