3d旋转轴
perspective: 距离电脑屏幕距离
backface-visibility: 就是把div转过来还显示div的颜色不
perspective-origin
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
![](https://user-gold-cdn.xitu.io/2018/9/2/16595e357bd31a92?w=425&h=300&f=png&s=21879)
<style>
.fc_wrapper {
width: 150px;
height: 235px;
box-sizing: border-box;
border: 1px solid #e67e22;
perspective: 1000px;
}
.fc_wrapper:hover .fc_inner {
transform: rotateY(-180deg) translateZ(0);
}
.fc_inner {
position: relative;
width: 100%;
height: 100%;
transform-style: preserve-3d;
/* backface-visibility: hidden; */
transform-origin: center center;
transition: transform 0.8s;
}
.fc_front {
position: absolute;
z-index: 4;
left: 0;
top: 0;
width: 100%;
height: 100%;
background-color: red;
backface-visibility: hidden;
}
.fc_back {
position: absolute;
z-index: 2;
left: 0;
top: 0;
width: 100%;
height: 100%;
background-color: blue;
/* backface-visibility: hidden; */
}
</style>
</head>
<body>
<div class="fc_wrapper">
<div class="fc_inner">
<div class="fc_front"></div>
<div class="fc_back"></div>
</div>
</div>
</body>
</html>
复制代码