← TechnologyThe essentials of

aspect-ratio: height that follows width

Publisher: ResumeMaker • 1 source

Published: 22 Oct 2026 13:13 · Updated: 22 Oct 2026 13:13

AI source check: 21 Oct 2026 10:36. This is not editorial approval.

In a few sentences

In brief

The set ratio helps the block retain shape when at least one of its dimensions is automatic.

Useful to know

aspect-ratio sets a preferred width-to-height ratio. With width: 100%; aspect-ratio: 16 / 9; block and automatic height, the browser can calculate the height from the available width. If the width is 320 pixels, the corresponding height is 180 pixels. This is an arithmetic example. [1]

The property is convenient for video frames, galleries, and pre-booked space. It describes the geometry of the box, but does not determine by itself whether the image inside will be cut or stretched. Appropriate content rules are also needed for this.

When you specify both specific width and height, ratio does not override these dimensions. If the item looks incorrect, first check that the height is actually auto, as well as whether other constraints are not involved in the calculation. [1]

Sources

For further detail and to check the information:

  1. [1] MDN — aspect-ratio ↗