— by Nesim


The aspect-ratio property is a new CSS property that allows you to set the ratio between the width and height of an element. Though it is not forcing the aspect ratio – with a lot of text it grows to prevent text overflow. Or as a flex child in certain conditions, it will grow or shrink by default to fill the available space.

Session CodePen

See this Pen on CodePen.

Browser Support

Fully supported on all modern browsers since 2021! 🎉 Can I Use: Aspect Ratio