
image.png
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<style>
.container {
margin-left: 100px;
margin-top: 100px;
width: 200px;
height: 200px;
border:1px solid gray;
position: relative;
transform-style: preserve-3d;
animation: zhuan 10s linear infinite;
}
.demo1 {
width: 200px;
height: 200px;
background: red;
position: absolute;
inset: 0;
transform: translate3d(0, 0, 40px);
clip-path: polygon(
0 0,
100% 0,
100% calc(100% - 30px),
calc(100% - 30px) 100%,
0 100%,
0 0,
4px 4px,
4px calc(100% - 4px),
calc(100% - 30px) calc(100% - 4px),
calc(100% - 4px) calc(100% - 30px),
calc(100% - 4px) 4px,
4px 4px
);
}
.demo2 {
width: 200px;
height: 200px;
background: rgba(0, 128, 0, 0.56);
position: absolute;
inset: 0;
transform: translate3d(0, 0, 20px);
clip-path: polygon(
0 0,
100% 0,
100% calc(100% - 30px),
calc(100% - 30px) 100%,
0 100%,
0 0
);
}
@keyframes zhuan {
to{
//transform: rotateY(360deg);
transform: rotate3d(1, 1, 0, 360deg);
}
}
</style>
</head>
<body>
<div class="container">
我是容器
<div class="demo1">我是内容</div>
<div class="demo2"></div>
</div>
</body>
</html>
网友评论