css 实现旋转八卦图

时间:2023-03-08 20:46:05
css 实现旋转八卦图

虽然这不算什么亮点,不过也可以供路上的小伙伴学习下

直接上干货:

<!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 type="text/css">
* {
margin: 0;
padding: 0;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
text-decoration: none;
list-style: none;
}
.container {
width: 200px;
height: 200px;
display: inline-block;
margin: 100px;
border: 1px solid #ccc;
overflow: hidden; -webkit-animation: Rotate 6s linear infinite;
}
.c_r, .c_l {
width: 99px;
height: 200px;
float: left;
position: relative;
} .min_r, .min_l, .core_r, .core_l {
position: absolute;
} .c_r, .min_r, .core_l {
background-color: #fff;
}
.c_l, .min_l, .core_r {
background-color: #000;
}
.min_r, .min_l, .core_r, .core_l, .container {
border-radius: 50%;
} .min_r, .min_l {
width: 100px;
height: 100px;
z-index: 10;
}
.min_l {
left: 50%;
bottom: 1px;
}
.min_r {
right: 50%;
top: 0;
} .core_r, .core_l {
width: 20px;
height: 20px;
top: 40px;
left: 40px;
}
@-webkit-keyframes Rotate {
0%{transform: rotate(0deg)}
100%{transform: rotate(360deg)}
} @keyframes Rotate {
0%{transform: rotate(0deg)}
100%{transform: rotate(360deg)}
} </style>
</head>
<body>
<div class="container">
<div class="c_l">
<span class="min_l">
<span class="core_l"></span>
</span>
</div>
<div class="c_r">
<span class="min_r">
<span class="core_r"></span>
</span>
</div>
</div>
</body>
</html>