Aspect Ratios in CSS are a Hack | Responsive Web Design

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 widthheight, and aspect-ratio but with a wrong aspect-ratio for that width/height combination?

An excerpt from Aspect Ratios in CSS are a Hack

View original article

Subscribe to our Newsletter

Add your email address and receive an email every Friday covering off everything worth knowing about building your websites responsively.