I got a div that has margins and inside it, I got 2 other divs: One on top and one below it. I want the div below the top div to fill the empty space to the margin of the main div.
Here's my structure:
<div class="main">
<div class="top"></div>
<div class="bottom"></div>
</div>
CSS:
.main {
width: 90px;
height: 30vh;
min-height: 225px;
margin: 0;
margin-left: 5px;
margin-top: 25px;
margin-bottom: 25px;
}
.main div's height resizes by viewheight.
.top div is a form which has an height of 220px.
.bottom div should fill the empty space between the .top and margin-bottom.
I've tried everyhing I know. If I try vh or %, it overflows the margin-bottom once I resize the browser. If I fix it to the bottom, it overflows the .top div. Top div has transparent elements and I can't hide the .bottom div under the top div.
My guess is that somehow I need to get the distance from the .top div to the margin-bottom and set it as height for the .bottom div. But I've looked for solutions for over an hour and nothing.
And no. This question is not a duplicate of the ones under the title. I'm looking for compatibility too. Flexbox and Js is not good.