I have been struggling with this problem for a couple of weeks now. I have a container which is 90vh. I have some header text and below it is an image. I need to maintain the aspect ratio of 16:9. But, the height must never exceed the height of the container causing scrollbar to appear. Is it doable??
Here is the calculation for 16:9 aspect ratio
To get height base on width (9 * WIDTH) / 16;
To get width base on height (16 * HEIGHT) / 9
https://codesandbox.io/s/sleepy-sara-ew3oj9?file=/src/styles.css