CSS aspect-ratio foundations

--

block-size: 100dvh

Intro

The aspect-ratio CSS property is responsible for the selected HTML element proper sizes. Luckily nowadays it have wide range of browser support.

Foundations

aspect-ratio: inherit;
/* inheritable like other CSS values…*/

aspect-ratio: unset;
/* setting the property not to contain a value… */

aspect-ratio: 1;
/* block-size equals inline-size ratio */

aspect-ratio: 1 / 1;
/* equal: 1 */

aspect-ratio: 16 / 9;
/* inline-size and block-size ratio equal 16:9 */

aspect-ratio: auto;
/* initial value… */

Sources

--

--