CSS aspect-ratio Property Explained
What the CSS aspect-ratio property does, with an example.
Published November 5, 2026
The CSS aspect-ratio property sets a preferred width-to-height ratio for an element's box, useful for responsive media.
Key points
- Check browser compatibility on a resource like caniuse.com if targeting older browsers
Example
aspect-ratio: 16 / 9;