JSFiddle - React, Tailwind, and code Playground
by meo
HTML
<div class="container">
<div class="cube">
<div class="back">
</div>
<div class="bottom"></div>
<div class="right"></div>
<div class="top"></div>
<div class="left"></div>
<div class="front">
</div>
</div>
</div>
CSS
body {
background-color: #fff;
background-image: -webkit-linear-gradient(top, rgba(0,0,0,.8), rgba(0,0,0,.7));
height: 100%;
}
.container {
margin: 100px auto;
position: relative;
-webkit-perspective: 1000;
width: 200px;
height: 200px;
}
.cube {
position: absolute;
width: 200px;
height: 200px;
-webkit-transform-style: preserve-3d;
-webkit-transition: -webkit-transform 1s;
-webkit-transform: rotateY( 46deg ) rotateX( -15deg ) rotateZ( -15deg );
}
.cube:hover {
-webkit-transform: rotateY( -314deg ) rotateX( -15deg ) rotateZ( -15deg );
}
.cube > div:after {
content: "";
position: absolute;
top: 10px;
left: 10px;
right: 10px;
bottom: 10px;
background: rgba(255,255,255,.2);
color: rgba(255,255,255,.2);
font-size: 70px;
box-shadow: 0 0 30px rgba(255,255,255,.1);
border-radius: 3px;
}
.cube > div {
position: absolute;
width: 198px;
height: 198px;
border: 2px solid rgba(0,0,0,.03);
line-height: 180px;
font-weight: bold;
text-align: center;
-webkit-backface-visibility: hidden;
-webkit-box-shadow: 0 0 20px rgba(255,255,255,.4);
-webkit-transition: background 1.6s, -webkit-transform 1s;
background: rgba(255,255,255,.9);
}
.cube:hover > div {
background: rgba(0,255,255,.7);
}
.cube .front { -webkit-transform: rotateY(0deg) translateZ( 100px ); }
.cube .back { -webkit-transform: rotateX(180deg) translateZ( 100px ); }
.cube .right { -webkit-transform: rotateY(90deg) translateZ( 100px ); }
.cube .left { -webkit-transform: rotateY(-90deg) translateZ( 100px ); }
.cube .top { -webkit-transform: rotateX(90deg) translateZ( 100px ); }
.cube .bottom { -webkit-transform: rotateX(-90deg) translateZ( 100px ); }