I have a slideshow sort of thing where images will expand as large as they can, but not exceed the viewport\'s width or height. Basically object-fit: contain.>
I think I got it (1/2) is equal to (width/height):
Or with more code:
As a side note: I also have written a script that automatically calculates the right sizes for parent height/width constrained sizes. See here the parent-fit script.