Daily Software Tips & Tricks
Bite-sized knowledge to improve your coding skills daily.
Simplify Layouts with aspect-ratio
March 26, 2026
Gone are the days of the "padding-bottom hack" to keep your video embeds or image containers perfectly square or 16:9. Modern CSS now supports the aspect-ratio property. Just set "aspect-ratio: 16 / 9;" and the browser handles the height automatically based on the width, even as the viewport changes.
It is a small addition that removes a lot of boilerplate code and makes responsive design feel much more intuitive.