How do I get an image to stay centered when its fluid width (percentage based) container is too small to show the whole image?
I had the same problem but the solutions here didn't help me (because I'm displaying inside a table and because I wanted the image to change without having to scale it manually every time as the image was sent by clients)
Here's what I found, much more effecitve and easier :
img {
object-fit: cover;
width: 150px;
height: 150px;
}