如图所示
直接上干货
html
<!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>好看的加载动画</title>
<link rel="stylesheet" href="./666.css">
</head>
<body>
<div class="loader">
<div></div>
<div></div>
<div></div>
<div></div>
</div>
</body>
</html>
css
*{
margin: 0;
padding: 0;
}
body{
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
background: linear-gradient(15deg,#13547a,#80d0c7);
}
.loader{
width: 200px;
height: 200px;
position: relative;
}
.loader div{
border-width: 5px;
border-style: solid;
border-left-color: #fff;
border-right-color: #fff;
border-top-color: transparent;
border-bottom-color: transparent;
border-radius: 50%;
position: absolute;
animation: spin 2s ease infinite;
}
.loader div:nth-child(1){
width: 50px;
height: 50px;
left: 70px;
top: 70px;
}
.loader div:nth-child(2){
width: 70px;
height: 70px;
left: 60px;
top: 60px;
animation-delay: 0.1s;
}
.loader div:nth-child(3){
width: 90px;
height: 90px;
left: 50px;
top: 50px;
animation-delay: 0.2s;
}
.loader div:nth-child(4){
width: 110px;
height: 110px;
left: 40px;
top: 40px;
animation-delay: 0.3s;
}
@keyframes spin {
50% {
transform: rotate(180deg);
}
100% {
transform: rotate(0);
}
}