body {
/* 控制3d效果 */
perspective:1000px;
overflow:hidden;
}
.box {
width:400px;
height:240px;
margin:0 auto;
/* background-color:greenyellow;
*/
box-shadow:0px 0px 20px gray;
/* 开启3d */
transform-style:preserve-3d;
/* 添加过渡 */
transition:all 0.2s
}
代码里有详细注释,其中关键点是旋转角度的百分比,