How can I create square image containers in Webflow and have the image fill the container without changing the aspect ratio?

Published on
September 22, 2023

To create square image containers in Webflow while maintaining the aspect ratio of the image, you can follow these steps:

  1. Open your Webflow project and navigate to the page where you want to add the square image container.
  2. Add a Div Block to your page or select an existing element that you want to use as the container for the image.
  3. Set the height of the Div Block to the desired height for the square image container. For example, you can set it to "200px" for a container that is 200 pixels in height.
  4. Add an Image element inside the Div Block. You can either drag and drop an image into the Image element or select an existing image from your assets.
  5. By default, the Image element will have a set width and height. To make the image fill the container without changing the aspect ratio, you need to change the width to "100%" and the height to "auto". This will ensure that the image always fills the container while maintaining its original aspect ratio.
  6. If the image appears distorted or stretched, make sure the original image itself is not stretched. You can use image editing software to crop or resize the image to match the aspect ratio you desire.
  7. Save your changes and preview your page to see the square image container with the image filling it while maintaining the aspect ratio.

Keep in mind that if you have multiple square image containers on your page, you can follow the same steps for each container to achieve the desired effect.

Additional questions:

  1. How do I resize an image in Webflow?
  2. Can I add a hover effect to the square image container in Webflow?
  3. Is it possible to add a border around the square image container in Webflow?