How to make an image(fixed ratio) resize based on % of height and not width

I’m having this issue right now, trying to build a mobile app and the images that are fixed ratio, doesn’t stop growing in height, surpassing it’s group height, because the image change dimensions based on width, if the image wasn’t fixed ratio, I wouldn’t have this problem but the image would get distorted, and it looks horrible when it stretches

I think it can be fixed by making the image change its dimensions based on the % height of the group or maybe setting the picture to stop growing when it reaches its group width or height

But I don’t know how to do it

Any thoughts on how to make this possible, It might be possible with conditions but it would be too much hassle

Here’s a video so you can see what I mean

Why would I want that? Because if the app gets in landscape mode I want it to be responsive


Just use “vw”.

Attach an ID to the image and have it resize based on VW.

Just a little custom CSS.


You want to use the images “make image same width of parent element”.

VW or VH? I tried to use css tools adding a class to the image, and when I try to use vh or vw I takes the vh-vw from the whole page and not the container, how to I fix that?