效果图:
代码:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<style>
.box{
position: relative;
width: 200px;
height: 200px;
margin: 100px auto;
transition: all 2s;
/* 子元素增加视距 */
perspective: 500px;
/* 旋转时子元素保持3d效果 */
transform-style: preserve-3d;
}
.box:hover{
transform: rotateY(180deg);
}
.box>div{
position: absolute;
width: 100%;
height: 100%;
border-radius: 50%;
cursor: pointer;
line-height: 200px;
text-align: center;
color: white;
font-weight: 700;
font-size: 25px;
}
.front {
background-color: rgba(255, 106, 0);
transform: translateZ(1px) ;
}
.back {
background-color: rgba(51, 51, 51);
transform: rotateY(180deg);
}
</style>
<body>
<div class="box">
<div class="front"> ARE YOU OK ? </div>
<div class="back"> 干翻华为 </div>
</div>
</body>
</html>