HTML
<div class="box">
<div class="side front"></div>
<div class="side back"></div>
<div class="side left"></div>
<div class="side right"></div>
<div class="side top">
<div class="tl"></div>
<div class="tr"></div>
</div>
<div class="side bottom"></div>
<div class="text">求点赞~</div>
</div>
CSS
*{
/* 初始化 */
margin: 0;
padding: 0;
box-sizing: border-box;
}
body{
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
background-color: #e0c9a5;
}
.box{
display: flex;
justify-content: center;
align-items: center;
position: relative;
transform-style: preserve-3d;
perspective: 1000px;
transform: rotateX(-20deg);
}
.side{
position: absolute;
width: 200px;
height: 200px;
background-color: #c09551;
border: 1px solid #e4c084;
}
/* 前 */
.front{
transform: translateZ(100px);
}
/* 后 */
.back{
transform: translateZ(-100px) rotateY(180deg);
}
/* 左 */
.left{
transform: translateX(-100px) rotateY(-90deg);
}
/* 右 */
.right{
transform: translateX(100px) rotateY(90deg);
}
/* 上 */
.top{
transform: translateY(-100px) rotateX(90deg);
background-color: transparent;
transform-style: preserve-3d;
}
.top div{
background-color: #c09551;
position: absolute;
top: 0;
width: 50%;
height: 100%;
border: 1px solid #e4c084;
transition: 0.5s;
}
.top .tl{
left: 0;
transform-origin: left;
}
.top .tr{
right: 0;
transform-origin: right;
}
/* 下 */
.bottom{
transform: translateY(100px) rotateX(-90deg);
box-shadow: 5px -5px 15px rgba(0,0,0,0.4);
}
.box:hover .top .tl{
transform: rotateY(-135deg);
}
.box:hover .top .tr{
transform: rotateY(135deg);
}
.box .text{
width: 200px;
text-align: center;
font-size: 30px;
font-weight: bold;
transition: 0.6s;
}
.box:hover .text{
transform: translateY(-250px);
}