I have a fixed height div. Inside that div I want to stack an image on top of text. I want the text area to govern how much space the image has. I'd like to do this with CSS only. I'm sure I could devise a system with JS, but I'm trying to avoid it for this instance.
More details:
If the text requires three lines, then the image above should be max-width: 100%
and max-height
to not exceed what is left over from the text's space taken. So if the parent div is 750px and the text requires 100px of height, the image should at most be allowed to be 650px tall.
I've been messing around with flex-box and such, trying to use flex-column and things and I cannot keep the image limited in size. I had 2 div areas stacked and the top was shrinking with the text, but then when I dropped the image in, it broke.
Is this even achievable with CSS alone.
This is what I have and an example of it not working: https://jsfiddle.net/aoqerm06/
<div style="height: 400px;" class="d-flex flex-column">
<div class="bg-primary h-100" >
IMAGE GOES HERE
</div>
<div class="flex-grow-1">
LOTS OF TEXT HERE
</div>
</div>