老师,怎样才能把代码写的简练些.总觉得很冗长
<!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>
*{
padding: 0;
margin: 0;
}
.no0{
width: 800px;
height: 800px;
border: 1px solid #000;
margin: 50px auto;
padding: 100px;
border-radius: 50%;
}
.no0 .box{
width: 200px;
height: 200px;
margin: 100px;
position: relative;
float: left;
perspective: 500px;
}
.no0 .box::before{
content: '';
display: block;
width: 200px;
height: 200px;
background: url(cat.jpg) no-repeat center/100%;
border-radius: 50%;
border: 1px solid #000;
}
.no0 .box::after{
content: '';
display: block;
width: 200px;
height: 200px;
background: url(dog.jpg) no-repeat center/100%;
position: absolute;
top: 0;
left: 0;
border-radius: 50%;
border: 1px solid #000;
transform-origin: 0 0;
transition: transform 1s linear 0s;
}
.no0 .box:hover::after{
transform: rotateY(-180deg);
}
.no0 .no2::after{
transform-origin: 100% 0;
}
.no0 .no2:hover::after{
transform: rotateY(180deg);
}
.no0 .no3:hover::after{
transform: rotateX(180deg);
}
.no0 .no4::after{
transform-origin: 0 100%;
}
.no0 .no4:hover::after{
transform: rotateX(-180deg);
}
</style>
</head>
<body>
<div class="no0">
<div class="box no1"></div>
<div class="box no2"></div>
<div class="box no3"></div>
<div class="box no4"></div>
</div>
</body>
</html>
7
收起
恭喜解决一个难题,获得1积分~
来为老师/同学的回答评分吧
0 星