I am building a website that displays NBA players. To do this, I am creating a div called "player-holder" and putting an image called "player-image" inside, so that it displays, essentially a portrait of my player.
My CSS code looks like this:
#player-image {
object-fit: cover;
width: 100%;
height: 100%;
}
#player-holder {
border: 2px solid black;
width: 100px;
height: 100px;
}
Currently, my player image appears at the bottom of the player holder, which is good. However, my problem is that the image is bigger than what I would like it to be. How do I adjust the size of the player-image so that it stays at the bottom of the holder while maintaining its aspect ratio?
I tried switching it to object-fit: contain, but this leaves space between the bottom of the player holder and the image, which doesn't work for the purposes of my website. I also tried using a flex display with vertical columns, but this didn't seem to work either. Editing the width and height, just crop the image instead of shrinking it.
using object-position along with object-fit as shown in the example.