2

I have a flex (direction: row) container with two elements. The first is an image, and the second is a div. Each element takes up 50% of the container's width. My goal is to get the image to always be the same height as its sibling, whose size is determined by its content. The plan is to then use object-fit: cover on the image.

I can cause the image to grow to the height of its sibling with flex: 1, but I can't cause it to shrink to the height of its sibling if it's the larger of the two. Is it possible to have both?

kukkuz
  • 41,512
  • 6
  • 59
  • 95
Willerie
  • 69
  • 5

0 Answers0