<style>
body{
perspective: 400px;
}
.box{
position: relative;
width: 300px;
height: 300px;
margin: 100px auto;
transition: all .6s;
transform-style: preserve-3d;
}
.box:hover{
transform: rotateY(180deg);
}
.front,
.back{
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
border-radius: 50%;
font-size: 30px;
color: #fff;
/* 文字水平居中 */
text-align: center;
/* 文字垂直居中 */
line-height:300px ;
}
.front{
background-color: khaki;
/* z-index 属性指定一个元素的堆叠顺序 拥有更高堆叠顺序的元素总是会处于堆叠顺序较低的元素的前面。 */
z-index: 1;
}
.back{
background-color: green;
/* 两个盒子背靠背 */
transform: rotateY(180deg);
}
</style>
<body>
<div class="box">
<div class="front">张子枫</div>
<div class="back">我在这里等你</div>
</div>
</body>

