<head>
<meta charset="UTF-8" />
<title>How to create Dot Loading Animation</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<link rel="stylesheet" href="style.css" />
</head>
<body>
<div class="loader-outer">
<div class="loader">
<span class="dot dot-1"></span>
<span class="dot dot-2"></span>
<span class="dot dot-3"></span>
<span class="dot dot-4"></span>
</div>
</div>
</body>
* {
padding: 0;
margin: 0;
}
body {
display: flex;
align-items: center;
justify-content: center;
height: 100vh;
width: 100%;
background: #000;
}
.loader>span {
width: 15px;
height: 15px;
display: block;
background: #fff;
border-radius: 50%;
position: relative;
margin: 0 5px;
}
.loader {
display: flex;
align-items: center;
justify-content: center;
}
.dot-1 {
animation: anim 1s linear 0s infinite;
}
.dot-2 {
animation: anim 1s linear 0.25s infinite;
}
.dot-3 {
animation: anim 1s linear 0.50s infinite;
}
.dot-4 {
animation: anim 1s linear 0.75s infinite;
}
@keyframes anim {
0% {
top: 0;
}
50% {
top: 15px;
}
100% {
top: 0;
}
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.