Keeping an image's proportions used to require the "padding hack" — padding-top: 56.25% (16:9's height-over-width) on a wrapper set to position: relative, with the child image absolutely positioned to inset: 0. A lot of incidental code for something conceptually simple.
The aspect-ratio property, supported by major browsers since 2021, replaces that trick. aspect-ratio: 16/9 alone means the height is computed automatically once the width is known (or vice versa). It also reserves space before an image loads, preventing the layout-shift jump known as CLS (Cumulative Layout Shift).
An <img> that already has width and height attributes gets its ratio computed automatically by the browser, so CSS often isn't even needed there. The CSS aspect-ratio property mostly matters for color-only placeholders, video wrappers, and custom cards.