CSS Tricks4
pure css loading animation
by Soya Natsuki
HTML
<html>
<head>
<title>Loading Animation</title>
</head>
<body>
<div class="loader">
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
</div>
</body>
</html>
CSS
body {
margin: 0;
padding: 0;
}
.loader {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%,-50%) rotate(45deg);
width: 150px;
height: 150px;
border: 10px solid #262626;
}
span {
width: 50px;
height: 50px;
background: #262626;
display: block;
float: left;
animation: animate 2s linear infinite;
}
span:nth-child(3) {
animation-delay: .8s;
}
span:nth-child(2),
span:nth-child(6) {
animation-delay: .6s;
}
span:nth-child(1),
span:nth-child(5),
span:nth-child(9) {
animation-delay: .4s;
}
span:nth-child(4),
span:nth-child(8) {
animation-delay: .2s;
}
span:nth-child(7) {
animation-delay: 0s;
}
@keyframes animate {
0% {
transform: scale(1);
}
30% {
transform: scale(0);
}
50% {
transform: scale(0);
}
75% {
transform: scale(1);
}
100% {
transform: scale(1);
}
}