Source code:
<!DOCTYPE html>
<html lang=”en”>
<head>
<meta charset=”UTF-8″>
<meta name=”viewport” content=”width=device-width, initial-scale=1.0″>
<title>Rotating Square Dots Loader</title>
<style>
body{
margin: 0;
padding: 0;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
background: radial-gradient(circle, #b3c9df, #2196F3);
}
.loader-container{
position: relative;
width: 80px;
height: 80px;
}
.dot{
position: absolute;
width: 15px;
height: 15px;
background: yellow;
animation: rotateDots 1.5s linear infinite;
}
.dot:nth-child(1){
background: orange;
top: 0;
left: 50%;
transform: translateX(-50%);
}
.dot:nth-child(2){
background: red;
top: 50%;
left: 100%;
transform: translateY(-50%);
animation-delay: 0.3s;
}
.dot:nth-child(3){
background: blue;
top: 100%;
left: 50%;
transform: translate(-50%, -100%);
animation-delay: 0.6s;
}
.dot:nth-child(4){
background: green;
top: 50%;
left: 0%;
transform: translateY(-50%);
animation-delay: 0.9s;
}
@keyframes rotateDots {
0%{
transform: scale(1);
}
50%{
transform: scale(1.5);
}
100%{
transform: scale(1);
}
}
</style>
</head>
<body>
<div class=”loader-container”>
<div class=”dot”></div>
<div class=”dot”></div>
<div class=”dot”></div>
<div class=”dot”></div>
</div>
</body>
</html>