What does object-fit property do?

Aneeqa Khan - Sep 12 '22 - - Dev Community

Last time I wrote about the topic of responsive images and object-fit plays a vital role in displaying images.

Usually, during displaying user-uploaded images we face the issue of image replacement according to the UI.

For example, if you want to show a rectangle image in a square box, it will be shown as a stretched image in a browser.

To fix this kind of issue, object-fit CSS property is beneficial.

I have created a simple app to demonstrate object-fit property usage and benefits.

Thank you for reading!
Feel free to connect on Twitter

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .