<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title></title>
<style type="text/css">
*{
margin: 0;
padding: 0;
}
body{
perspective: 1000px;
}
.bigbox{
position: relative;
transform-style: preserve-3d;
width: 400px;
height:400px;
margin: 200px auto;
animation: wh 3s infinite linear;
line-height: 400px;
font-size: 40px;
text-align: center;
}
@keyframes wh{
from:{
transform: rotate3d(0,0,0,0);
}
to{
transform: rotate3d(1,1,1,360deg);
}
}
.bigbox div{
position: absolute;
top: 0;
left: 0;
width: 400px;
height: 400px;
border: 1px solid black;
transition: all 1s linear;
}
.bigbox div:nth-child(1){
transform: translateZ(200px);
}
.bigbox div:nth-child(2){
transform: translateZ(-200px);
}
.bigbox div:nth-child(3){
transform: translateX(-200px) rotateY(90deg);
}
.biigbox div:nth-child(4){
transform: translateX(200px) rotateY(90deg) ;
}
.bigbox div:nth-child(5){
transform:translateY(-200px) rotateX(90deg);
}
.bigbox div:nth-child(6){
transform: translateY(200px) rotateX(90deg);
}
.bigbox:hover div:nth-child(1){
transform: translateZ(-300px);
}
</style>
</head>
<body>
<div class="bigbox">
<div>1</div>
<div>2></div>
<div>3></div>
<div>4></div>
<div>5></div>
<div>6</div>
</div>
</body>
</html>