I am using object-fit: cover
on a bunch of images. The frame for the image takes up 50vw
and has a dynamic height. The cover attribute works great, but it means that I don't really know how wide my actual image will be at a given time.
Most likely it will be wider than the 50vw
and will have its overflow hidden due to the object-fit cover.
The problem comes in when I try to use srcset. I am unable to give a reliable width for the sizes attribute.
I know that size only needs an approximation, but I am curious if anyone has dealt with this before.
You can add width, height, min- & max-width or height as attributes on the srcset like this.