V
V
vvovas2018-02-07 05:49:35
css
vvovas, 2018-02-07 05:49:35

How to prevent a flexbox container from shrinking if the content no longer fits inside it?

Hello.
There is a page on which the header is of an unknown size and content, which is stretched to all the remaining space.
Content contains three blocks: top, area, bottom. Top and bottom are of unknown height, area should take up the remaining space and have a minimum height (let's say 50px).
Implementation : https://codepen.io/anon/pen/rJMqaP
Current Behavior : When the page height is reduced, the content continues to shrink even when the top,area,bottom blocks are already popping out of it.
5a7a6906c0adb529778758.pngExpected Behavior : content shrinks as long as the inner blocks fit in it. After that, the compression stops.
If the height of the blocks were known, I would set the minimum height of the content container, but the height is not known.
How to correctly implement the desired behavior?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vasily Varyukhin, 2018-02-07
@vvovas

You almost made it. Just a few fixes.
Example on CodePen

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question