Get your own website Result Size: 625 x 565
x
 
<!DOCTYPE html>
<html>
<head>
<style>
#DIV1 {
  height: 200px;
  width: 200px;
  margin: auto;
  border: 1px solid black;
}
#DIV2 {
  height: 150px;
  border: 1px solid black;
  background-color: coral;
  aspect-ratio: 1;
  animation: mymove 5s infinite;
}
@keyframes mymove {
  33% {aspect-ratio: 0.5;}
  66% {aspect-ratio: 2;}
}
#DIV2original {
  position: absolute;
  z-index: -1;
  height: 150px;
  aspect-ratio: 1;
  border: 1px dashed grey;
  background-color: lightgrey;
  opacity: 0.5;
}
</style>
</head>
<body>
<h1>Animation of aspect-ratio property</h1>
<p>Gradually changes the aspect-ratio property from "1" to "0.5" to "2", and back:<p>
<p><b>Note: </b>The grey DIV element indicates where the DIV2 element would be with "1" as value for aspect-ratio property.</p>
<div id="DIV1">DIV1
  <div id="DIV2original">DIV2</div> 
  <div id="DIV2">DIV2</div>
</div>