In a 3-row layout:
Here is the codepen demo showing the solution:
Important highlights:
html, body, ... .container, should have the height set to 100%flex to ANY of the flex items will trigger calculation of the items sizes based on flex distribution:
flex, for example: flex: 1 then this flex item will occupy the remaining of the spaceflex property, the calculation will be more complicated. For example, if the item 1 is set to flex: 1 and the item 2 is se to flex: 2 then the item 2 will take twice more of the remaining space
flex-direction propertyflex property: https://www.w3.org/TR/css-flexbox-1/#propdef-flex
min-* and max-* will be respected