loading有多种实现方式,只写了一种,代码如下,仅供参考~
<!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>
.loadingWrap {
width: 50px;
height: 50px;
position: relative;
margin: 0 auto;
margin-top: 100px;
}
.loadingWrap span {
display: inline-block;
width: 8px;
height: 8px;
border-radius: 50%;
background: #0a50cc;
position: absolute;
-webkit-animation: load 1.04s ease infinite;
}
@-webkit-keyframes load {
0% {
opacity: 1;
}
100% {
opacity: 0.2;
}
}
.loadingWrap span:nth-child(1) {
background-color: red;
left: 0;
top: 50%;
margin-top: -8px;
-webkit-animation-delay: 0.13s;
}
.loadingWrap span:nth-child(2) {
background-color: greenyellow;
left: 25%;
top: 25%;
margin-left: -8px;
margin-top: -8px;
-webkit-animation-delay: 0.26s;
}
.loadingWrap span:nth-child(3) {
background-color: hotpink;
left: 50%;
top: 0;
margin-left: -8px;
-webkit-animation-delay: 0.39s;
}
.loadingWrap span:nth-child(4) {
background-color: teal;
top: 25%;
left: 75%;
margin-top: -8px;
margin-left: -8px;
-webkit-animation-delay: 0.52s;
}
.loadingWrap span:nth-child(5) {
top: 50%;
right: 0;
margin-top: -8px;
margin-right: 8px;
-webkit-animation-delay: 0.65s;
}
.loadingWrap span:nth-child(6) {
left: 75%;
top: 75%;
margin-left: -8px;
margin-top: -8px;
-webkit-animation-delay: 0.78s;
}
.loadingWrap span:nth-child(7) {
bottom: 0;
left: 50%;
margin-left: -8px;
margin-bottom: 8px;
-webkit-animation-delay: 0.91s;
}
.loadingWrap span:nth-child(8) {
top: 75%;
left: 25%;
margin-top: -8px;
margin-left: -8px;
-webkit-animation-delay: 1.04s;
}
</style>
</head>
<body>
<div class="loadingWrap">
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
</div>
</body>
</html>