March 9, 2023

Six years ago I tweeted the following: Wish there was a way to set height of element in proportion to width in CSS. So if I wanted a square, I could set height to 100% of width.

Today, I have a way to do that with aspect-ratio. I could set aspect-ratio: 1 to achieve a square with an element.

I expanded this note into a blog post, Aspect-ratio and container query units six years later.