<div class="box">
<div class="front">你好div>
<div class="back">打工人div>
div>
body {
transform-style: preserve-3d;
perspective: 500px;
}
.box {
position: relative;
width: 200px;
height: 200px;
margin: 100px auto;
transition: all 0.5s;
transform-style: preserve-3d;
}
.box:hover {
transform: rotateY(180deg);
}
.front,
.back {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
border-radius: 50%;
text-align: center;
line-height: 200px;
color: #fff;
font-size: 50px;
}
.front {
background-color: red;
z-index: 1;
}
.back {
background-color: pink;
transform: rotateY(180deg);
}
浏览器调试后不能实现鼠标经过的时候,打工人字样出现,请求懂的人帮忙看看
body {
transform-style: preserve-3d;
perspective: 500px;
}
.box {
position: relative;
width: 200px;
height: 200px;
margin: 100px auto;
transition: all 0.5s;
transform-style: preserve-3d;
}
.box:hover {
transform: rotateY(180deg);
}
.front,
.back {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
border-radius: 50%;
text-align: center;
line-height: 200px;
color: #fff;
font-size: 50px;
}
.front {
background-color: red;
z-index: 1;
}
.front:hover{
display: none !important;
}
.back {
background-color: pink;
transform: rotateY(180deg);
}
.back:hover{
display: none !important;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
body {
transform-style: preserve-3d;
perspective: 500px;
}
.big_box {
width: 400px;
height: 400px;
background-color: orange;
}
.box {
position: relative;
width: 200px;
height: 200px;
border-radius: 50%;
margin: 100px auto;
transition: all 0.5s;
transform-style: preserve-3d;
}
.big_box:hover .box {
transform: rotateY(180deg);
}
.big_box:hover .back {
z-index: 2;
}
.front,
.back {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
border-radius: 50%;
text-align: center;
line-height: 200px;
color: #fff;
font-size: 50px;
}
.front {
background-color: red;
z-index: 1;
}
.back {
background-color: pink;
transform: rotateY(180deg);
}
</style>
</head>
<body>
<div class="big_box">
<div class="box">
<div class="front">你好</div>
<div class="back">打工人</div>
</div>
</div>
</body>
</html>