Solution - by “images” CSS trick (cropping-images-object-fit)
Why to use images? (And not bg) 1. Faster loading (Support webflow responsive image) feature, Better 2. SEO(And better Image SEO), Improve 3. Accessibility (Remember to add image alts). And last, more valid code.
How to:
Add extra div wrapper for the image
Set wrapper position to relative and padding-top to 56.25%:
If you want to use “img” trick above for regular flexbox grid (“not CMS”). Do not add padding-bottom: 56.25% For the col himself (Create extra div/wrapper):
Happy for those of you who worked this out. Unfortunately, trying to get this to work together with a collection inside of a grid is headache inducing. I don’t even know where to begin trying to figure out what’s going wrong with my many attempts.
Thanks !
I followed your guidelines but I surely miss something.
I have concerns about the fact I am using a lightbox inside a collection list but not on a collection page…
I had the same problem and here’s how I fixed it:
Place the lightbox AND its image inside of the new DIV-WRAPPER.
That corrects the relative/absolute positioning issue.
Create the image class as directed.
(I imagine this would apply to a layout using a link-block too but haven’t tested it)
I still wasn’t able to get it to work on Lightbox as explained here but I managed to get it done when setting up the VH of the holding collection item, and a matching min VH height for the img itself.