I realize there are other similar questions and I apologize if this has been answered, but I haven't been able to discern a solution to my question.
https://codepen.io/benrhere/pen/GRoLqPK
div {
height: 300px;
background-color: green;
display: flex;
border-style: dotted;
flex-direction: column;
}
img {
height: 100%;
object-fit: contain;
}
h4 {
width: 100%;
}
<div>
<h4>Headline inside of flexy</h4>
<img src="https://loremflickr.com/400/300" alt="image placeholder for a thumb that's supposed to present a featured work" class="work-thumb">
</div>
I want the image to be within the flexbox border. When I set the height of the image to 100%, it correctly sets it to the height of the parent box. But I need to account for the height of the first sibling in the div (the headline). Right now, I'm getting this: