object-fit and object-position

by Kevin Powell (HTML & CSS Tip of the Week

Whether it’s because of dynamic content or some other reason, sometimes we have inconsistent image sizes.

In these situations, object-fit can come in handy, where we can “fit” the image to the size we’ve declared using the cover and contain keywords, which work in a similar way as the same keywords with background-size.

Read here.
Published: 2025-07-18