How can I get this height constraint to work on webkit, just like FF (left)?
Left, firefox = good
Right, brave/safari = bad
Code:
https://codepen.io/flapusmog/pen/RwYvzvq
.f {
height:250px;
width:250px;
border:1px solid red;
}
.t {
font-size:50px;
}
img {
height:100%;
width:100%;
object-fit:contain;
/* not working */
flex-shrink:1;
}
.flex {
display:flex;
flex-direction: column;
}
<div class="f flex">
<div class="t">
Some<br>text
</div>
<img src="https://picsum.photos/200/300">
</div>
thanks, J
2
Answers
The answer is to add min-height:0 on the image
When you give img height 100%, it means that you give it 250px. That’s why there is the overflow.
Can you try this code.