JSFiddle - React, Tailwind, and code Playground
HTML
<div class="base">
<div class="test"></div>
<div class="ref"></div>
</div>
CSS
.base {
-webkit-perspective: 1000px;
-webkit-transform-style: preserve-3d;
-moz-perspective: 1000px;
perspective: 1000px;
border: solid 1px black;
position: absolute;
left: 10px;
top: 10px;
width: 120px;
height: 300px;
-webkit-animation: 10s rotate infinite;
}
.test, .ref {
position: absolute;
width: 100px;
height: 200px;
top: 50px;
}
.test {
left: 10px;
background-color: yellow;
-webkit-transform: rotateY(-90deg) translateX(150%) rotateY(90deg);
-webkit-transform-origin: 0% center;
}
.ref {
left: 10px;
border: solid 3px green;
-webkit-transform: translateZ(1000px);
}
@-webkit-keyframes rotate {
0% {-webkit-transform: rotateX(0deg);}
50% {-webkit-transform: rotateX(90deg);}
100% {-webkit-transform: rotateX(0deg);}
}