I have a CSS issue which perhaps is too specific for this forum but I think maybe other people will benefit from it as well. I have an element which has a max-height set, inside it there are two additional elements like so:
Code example:
<div class="container">
<div class="inner-element">...</div>
<div class="inner-element">...</div>
</div>
The the content of the two inner element has unknown height, which can be changed in runtime. I want the following behavior:
If the sum of the contents are less than max-height, they should each have their content's height, and the outer element should not be higher then their content:

If the sum of contents is more than max-height and both are more than half of it, each should get half the max-height:

If the sum of contents is more than max-height but one of the elements' content is less then 50%, the smaller one should have its content's height, and the bigger one should fill the remaining space:
I feel like that should be possible with pure CSS but I couldn't figure out a way to do it. Anyone has any idea?...

