Aspect Ratios in CSS are a Hack
Bram looks at a number of different approaches to create aspect ratios in CSS before closing with the hint that we could see something like height: aspect-ratio(16/9) which will allow you to calculate the height based upon the width.
Researching upon this topic it came to my attention that Tab Atkins started writing a proposal for this back in 2012, suggesting a likewise syntax. In it he highlighted a case where things would start to become fuzzy. What if you were to specify both the
An excerpt from Aspect Ratios in CSS are a Hackwidth
,height
, andaspect-ratio
but with a wrongaspect-ratio
for thatwidth
/height
combination?