Aspect-ratio is a new CSS property that works in all major browsers. It’s been supported in browsers for going on a year now, but with Safari finally catching up in September 2021, we can finally feel confident using it with aplomb. The custom property helps us cut down on repetition if we need more than one ratio.
Table of contents
Goodbye, padding hackPractical usage of aspect-ratioExpand to fitAspect ratio images with object-fitAspect ratio boxes in contextMinimum aspect ratioBrowser supportWrapping up3 Comments
Sort: