I have an img element inside a liquid div. That img has its max-height set to 100%. So, if the image is taller than the div, it should
img
div
max-height
If you still want the container to be % based and not px, you can make the container display: flex, and the image
display: flex
object-fit: contain; max-width: 100%;