Parent width question

  • /attachments/1315274759025594398/1315274759294025799/image.png

    ssssadsadasd

    1 month ago

    I have a ul with max width = 600px. I set the li inside it as width = max_width = 100%; same for the div inside this li. Now this div is a row with two elements: an image and another div. This last div goes beyond the parent so I set max_width = 100%, but this does not solve the problem in this case since 100% is considered as the whole parent div and not 100% - image_width.
    What should I do to make sure tha this last div does not go beyond the width of the parent? thanks
    image.png
  • Lucas G

    1 month ago

    Flex: 1
    πŸ‘1
  • Chris Laupama

    1 month ago

    Yup flex: 1

    100% is a direct size declaration that sets the dimension to exactly 100% of the parent container's corresponding dimension, regardless of layout context.

    flex:1 tells an element to grow and share available space proportionally with other flex items, making it responsive to the container's size changes.
    πŸ‘1
  • Armand

    1 month ago

    @ssssadsadasd here's an interactive guide on that: https://www.joshwcomeau.com/css/interactive-guide-to-flexbox/
    πŸ‘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.