Streaming live at 10am (PST)

[Tutorial] Perfectly square images or divs! (and responsive)

Hello Webflow-ers :wave: :webflow_heart:

I just thought I’d share a quick way to get perfectly square images everytime in the Webflow designer, regardless of the viewport size… I know some users struggle to do this without using explicit pixel sizing which isn’t ideal for responsiveness.

With this method, you can set it up once on the desktop viewport, and they will always stay square no matter what the size of the browser.

  • Add a Container, a Grid (make it 3 columns if you like) and add a single div into the grid

  • Next, give the div a height of 0px, and a top and bottom padding of 50% (make sure it’s percent, not pixels.

  • Also set overflow: hidden and give your div a position: relative
    You can see the settings with the blue style label below

  • That’s your div wrapper done

  • Now to add images:

  • add an image inside the div

  • Give a min-height and min-width of 100%

  • Set position: absolute and full
    Image 2020-09-03 at 9.56.13 am

  • Lastly, set the object-fit property to cover so the image fits properly, and is not skewed.

Screen Recording 2020-09-03 at 09.46.12 am

Now you can copy and paste the div wrapper a few times and see how it looks across different breakpoints. Checkout this Grid tutorial if you need to as well.

et voila

Which is French for “this is how you make images square and responsive”… I think.

Screen Recording 2020-09-03 at 10.03.22 am

Let me know if you found this helpful, or if theres a different way that you do it as well.

7 Likes

Thank you so much for this tutorial! I was having a tough time trying to get my CMS Collection wrap images to align inside the grid as the same size and this worked!

I am still trying to get my buttons at the bottom of the card to align as well. Do you have any tips for how I can do that? Right now they are basing there position off of how long the paragraph is before them.

1 Like

Hopefully this GIF explains it for you! :smiley:

Style the div with flexbox, and make the paragraph Grow if possible.

Shared with CloudApp

I applied flexbox to my div with a heading, paragraph, and button inside. Then made my paragraph grow but nothing changed in my layout. Do you know anything I could check that could be preventing it from working?

Feel free to add a read only link if possible, without it it’s difficult/almost impossible to say :slight_smile:

Here is my read only link:

I have applied flexbox to my “1IG STORIES” symbol but the buttons aren’t moving.

You seem to have an extra div. If you want the buttons at the bottom, you can try this…
To mkae it work on all the others, just rename the Div Block class and apply it to all the other div blocks.

Hope that helps!

Thank you for the information on that area but I was trying to refer to this area, called the “Teaser-Div-Block”. It’s within a CMS collection and it has flexbox applied and stretch on the paragraph.

tenor (5)
Sorry about that! :crazy_face:

Try this instead, (45sec video with sound.) I hope this helps :smiley:

1 Like

YES! Was the sizing of the blog wrap and the button preventing it from working? Thank you for the help that worked perfectly. :smile:

No worries. Yes, you need a specific height for the blog wrap to make them all equal, the Button was taking up space too. Glad it’s sorted.

If you have any more issues, feel free to open a new topic and share your link where possible. Welcome to Webflow forums! :wave: :webflow_heart:

1 Like