The End of Layout Shift

Before the aspect-ratio property, we used strange padding hacks to reserve space for images. Now, it’s one line of code.

Why it Matters

It prevents Cumulative Layout Shift (CLS) because the browser knows the height of the element before the image loads.

Grab the snippet in our HTML/CSS Snippets library!