CSS Live Demo: aspect-ratio Click the demo button below!
selector {
    aspect-ratio: auto || <ratio>
    /*
        <ratio>:
         - The ratio of width (number) to height (number).
         - f the slash (/) is omitted, the value represents the width-to-height ratio as a single number.
    */
}
aspect-ratio: 1 / 1; /* Same as '1/1'. Whitespace around the slash (/) does not affect interpretation. */
aspect-ratio: 1;
aspect-ratio: 16/9;
aspect-ratio: 1.77;
aspect-ratio: auto;

/* Global values */
aspect-ratio: inherit;
aspect-ratio: initial;
aspect-ratio: revert;
aspect-ratio: revert-layer;
aspect-ratio: unset;
div {
    background-color: orange;
    width: 200px;
    /*
        If height is not specified,
        the height defaults to auto.
    */
    aspect-ratio: 1; /* Equivalent to '1 / 1' */
}
<div>Box Element</div>
Rendered Output
div {
    background-color: orange;
    width: 200px;
    aspect-ratio: 1;
    height: 50px;
    /*
        If height is not auto,
        the aspect-ratio will not be applied.
    */
}
<div>Box Element</div>
Rendered Output
.flex-box {
    display: flex;
    align-items: stretch; /* This disables aspect-ratio */
}
.box-1,
.box-2 {
    width: 100px;
}
.box-1 {
    height: 200px;
    background-color: orange;
    margin-right: 15px;
}
.box-2 {
    background-color: red;
    height: auto;
    aspect-ratio: 1 / 1;
    /*
        aspect-ratio does not apply
        when align-items: stretch is active.
    */
}
<section class="flex-box">
    <div class="box-1">Box - 1</div>
    <div class="box-2">Box - 2</div>
</section>
Rendered Output
div {
    background-color: orange;
    width: 200px;
    aspect-ratio: 100%; /* Invalid: percentages are not allowed */
}
<div>Box Elemen</div>
Rendered Output
<video src="flower.mp4" autoplay muted playsinline loop></video>
video {
    width: 250px;
    border: 1px solid red;
    aspect-ratio: 1/1;
}
Rendered Output
video {
    width: 250px;
    border: 1px solid red;
    aspect-ratio: 1/1;
    object-fit: cover;  /* Fixes the empty space issue */
}
Rendered Output