Make images in grid responsive

  • /attachments/1325083252754747414/1325083253300002846/image.png

    Matthieu B.

    11 days ago

    Hello Toddle Jeddis
    I'm struggling with front-end display of images 🖼️

    See my 2 images attached.

    1st problem :
    When I resize the screen I want the image to be able to shrink (up to a certain point) to continue displaying my 2 columns (images).

    In mobile, I should have 1 column (image) stretched wide, and then if I increase the screen size, I should get 2 images that appear shrinked to their min size.

    2nd Problem:
    I want to have a set height on my image, WITHOUT making the image disproportionated.

    How would you, Jedi of toddle, go about those 2 problems, sticking to native toddle as much as you could ?

    Thanks a lot

    : get similar AI generated images on selfiebooth.ai
    image.png
  • /attachments/1325083252754747414/1325083607206858773/Screen_Shot_2025-01-04_at_1.37.54_PM.png

    Matthieu B.

    11 days ago

    And 2nd screenshot
    Screen_Shot_2025-01-04_at_1.37.54_PM.png
  • Matthieu B.

    10 days ago

  • J.ulian

    10 days ago

    Flexbox is great, but for such a layout, maybe grid will suit your needs better. Two blogposts are fine, but when a third one joins, it gets stretched out and spans the full container width.
    Grid is not supported in Toddle yet. Maybe this custom CSS will help you:

    Wrapper <div>

    width: 100%
    display: grid
    gap: 1rem
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr))

    Change the 300px in any value you like.

    https://developer.mozilla.org/en-US/docs/Web/CSS/grid-template-columns


    Inside of this wrapper grid div, you can repeat your cards.

    And for the image or img-wrapper inside of the cards:
    aspect-ratio: 1/1

    https://developer.mozilla.org/en-US/docs/Web/CSS/aspect-ratio
  • Matthieu B.

    10 days ago

    Nice, thanks a lot for the explaination @J.ulian . As you said the last image on her own get stretched.
    Let me try grid layout with the css
    👍1

Stop scrolling. Start building.

toddle is a visual web app builder that rivals custom code — but accessible to your entire team!

Try toddle — it's free!

© Copyright 2024 toddle. All rights reserved.