What does the CSS "aspect-ratio" property allow you to do, and how did developers commonly achieve this effect before it was introduced?
Correct! Well done.
Incorrect.
The correct answer is B) It lets an element maintain a specified width-to-height ratio (e.g. "aspect-ratio: 16/9") even as its size changes; previously this was commonly achieved with the "padding-top percentage hack" on a wrapper element
Correct Answer
It lets an element maintain a specified width-to-height ratio (e.g. "aspect-ratio: 16/9") even as its size changes; previously this was commonly achieved with the "padding-top percentage hack" on a wrapper element
aspect-ratio provides a direct, declarative way to maintain proportional dimensions for responsive elements (like video embeds), replacing the older technique of using a percentage padding-top on a relatively positioned wrapper to reserve aspect-ratio-correct space.