JSFiddle - React, Tailwind, and code Playground
HTML
<div id="container">
<div class="one" style="transform:translate3d(0,0,0)"></div>
<div class="two"></div>
<div class="one" style="transform:translate3d(0,200px,0)"></div>
<div class="two"></div>
<div class="one" style="transform:translate3d(100px,100px,0)"></div>
<div class="two"></div>
</div>
<div class="div one"></div>
CSS
#container {
-webkit-perspective:200px;
-webkit-transform-style:preserve-3d;
width:450px
}
.one {
position:absolute;
width:100px;
height:100px;
background-color:blue;
-webkit-transition:1s ease all;
border:1px solid black;
}
.two {
-webkit-transform:translate3d(0, 100px, 0);
position:absolute;
width:100px;
height:100px;
background-color:red;
-webkit-transition:1s ease all;
border:1px solid black
}
.one:hover {
-webkit-transform:scale3d(0, 0, 0);
}
.div.one {
width:100px;
height:100px;
background-color:green;
-webkit-transform:translate3d(0,400px,0);
}
.div.one:hover{
-webkit-transform:scale3d(0,0,0);
}