Oh man this is frustrating. I always thought I know my way around HTML and CSS but this is driving me crazy!
I have a blank black HTML page only containing a 16:9 iframe with the id "content".
In this iframe videos and photos with an 16:9 aspect ratio will be shown to the user (this will be an offline application running in Firefox, something like a primitive media player).
Everything inside the iframe works (quite an elaborate multimedia experience) everything is fine EXCEPT the placement/dimensions of that "player" iframe on the blank index page!
It needs to be centered VERTICALLY with a width of 100% thus touching both sides of the browser window,
it needs to be responsive when the browser windows is resized but needs to keep its aspect ratio of course,
and most important; it must always be completely visible! Meaning I must NOT be cropped by the browser window!
No big deal I reckon with tall 4:3 or 5:4 displays, when centered vertically there will be bars at the top and the bottom of the iframe (the black HTML body) and it won't be cropped anywhere.
But kind of a big deal with 16:10 an 16:9 displays since the browser toolbars and the Windows task bar and what have you screw everything up, the aspect ratio isn't really 16:9 or 16:10 anymore when the browser is maximized. So the 16:9 iframe would not be completely visible, it would get cropped a the bottom.
(or maybe the user hasn't even maximized the browser and uses the application in an awkward proportioned window with an even more extreme aspect ratio).
So the iframe needs to STOP growing responsively before its bottom side gets cropped by the browser window. Never be taller than 100vh.
I tried A LOT and in the end I had convoluted div-arrays with a shtload of CSS that accomplished almost everything except the bottom clipping.
I am aware of things like "vh" and "vw" and "max-height" and what have you and I tried A LOT. Never got that iframe from being cropped at the bottom when the browser windows gets too long. I tried things similar to THIS:
Vertically center responsive iframe
but with this the elements height cannot be limited to "100vh" since it uses this padding-workaround for keeping its aspect ratio. :-(
I mean this must be possible, right? A centered (h&v) 16:9 div/iframe that uses as much screen estate as possible but refrains from being cropped anywhere.
HELP PLEASE! Thank you!!