DEV Community

Toolloom
Toolloom

Posted on • Originally published at toolloom.com on

Say Goodbye to Padding Hacks

For years, developers used the "padding-bottom" trick to maintain aspect ratios for images and video containers, but those days are finally over. The modern "aspect-ratio" CSS property is now supported in all major browsers. Just set "aspect-ratio: 16 / 9;" on an element, and it will maintain that shape regardless of the width. It makes your layouts much cleaner and easier to reason about without the need for extra wrapper divs.

Top comments (0)