图一是hover效果
图二是未hover效果
完整代码
//代码
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
.box{
perspective: 800px;
border: 1px solid black;
}
.yy{
width:200px;
height: 300px;
background: #FF0000;
margin: 100px auto;
transition: all 0.3s;
}
.yy:hover{
box-shadow: 0 0 40px #000000;
opacity: .2;
transform: translate3d(0, 0, 400px);
}
</style>
</head>
<body>
<div class="box">
<div class="yy"></div>
</div>
</body>
</html>