3 ms·
Oh my god. I spent so freaking much time trying to solve “make the outermost div fill the screen of the device but always keep it a specific ratio.” Hours and
by Waterluvian 5y ago
Oh my god.
I spent so freaking much time trying to solve “make the outermost div fill the screen of the device but always keep it a specific ratio.”
Hours and hours. And hours.
- lelandfe 5y agoThe old answer, for those curious, was a padding-bottom with the aspect ratio expressed as a percentage: https://jsfiddle.net/9yLkm0tu/ https://jsfiddle.net/9yLkm0tu/ This works because padding percentages are calculated based on width – making this, at the time, the only practical way to form a relationship between an element's height and width. Thierry Koblentz coined this "intrinsic ratios" back in '09: https://alistapart.com/article/creating-intrinsic-ratios-for-video/ https://alistapart.com/article/creating-intrinsic-ratios-for... Some people call it a hack – it's just a narrow application of the spec.