I am facing a challenge with a simple structure:
<div class="parent">
<h1>Element taking space</h1>
<div class="stretch">
Not much content, but needs to be stretched to the end.
</div>
</div>
The issue lies in the fact that the parent div
has a fixed height, and I want div.stretch
to expand all the way to that height, regardless of its limited content. Using height: 100%
works initially, but once additional elements are added, it no longer stretches.
My understanding is that specifying height: 100%
makes the element match the exact same absolute/computed height as the parent, rather than occupying the remaining space after considering other elements.
While using overflow: hidden
would hide any overflow, that is not a suitable solution for me in this case.
Is there a CSS-only method to achieve this desired outcome?