Hi. I want my images to behave like in this video.
Can´t seem to find a way to do it.
What you see in the video aren’t images but background images. There are many differences from one to another.
Images
Background images
So if you want to fill a square div with an image, you have two solutions. You need to ask yourself “Is the image completely indispensable in the context of the content or is it only a decoration, an illustration?”
If the answer is: “No, they’re just decoration” then add images as background images inside of the div. Give the div the dimensions you want and set the options of the background image to fill the div or to be shown entirely. Set the repeating options too.
If the answer is: “Yes, the images should be a part of the content and never be dissociated from it” then you should refrain using them as background image. However you can use CSS code to make them fit to the dimensions and ratio of their parent element (a complicated way to say “you can crop them to their parents size”). Read below.
Constraint an image inside of an element using CSS object-fit
I made a page explaining various techniques of clipping, masking and fitting images and elements. Check the last section about fitting.
To use fitting with Webflow, you’ll have to use custom code. Here it is:
.fit { object-fit: cover; }
Here are all the values you can affect to the object-fit property:
You will see a lot, lot of people using background images when they should really use images, because it’s convenient and because Webflow has great options for it, where it doesn’t support fitting options at all. But it’s wrong, it’s a bad practice, a really bad one. It’s semantically wrong and an anti-accessibility practice.
Vincent, thank you so much for the response. Turns out i ended up using background images to do that. What got me confused was that in the video the blocks appear with the same class name in the elements list, but i guess they used a combo class to change image from block to block.
Thanks a lot!
pls mark @vincent answer as solution
(great answer) for future searches about this topic. Thanks!
Agreed, this and many other answers before it - thanks @vincent