loading...

Discussion on: Share your CSS knowledge

Collapse
markmercier profile image
Mark

My favorite thing about object-fit is that you can use it with img srcset for responsive background images! The picture element is cool if you really need to be serving differently cropped images, but whenever I can get away with same aspect ratio and not supporting IE, I always use object-fit + srcset for all background images.

Collapse
jamesthomson profile image
James Thomson

Definitely a good use case! Did this myself in a recent project in fact.