← Back toCSS Animation

Indeterminate progress bar

Written byPhuoc Nguyen
02 Oct, 2022
It is a variant of a progress bar. It is often used to inform users that a particular task is being processed but it's not possible to know when it will complete.


The progress bar is constructed by two elements, a container, and an inner bar:
<div class="progress-bar">
<div class="progress-bar__progress"></div>
The container has a background and rounded border:
.progress-bar {
/* Color */
background-color: #d1d5db;

/* Rounded border */
border-radius: 9999px;

/* Size */
height: 0.75rem;
The inner bar has similar styles with a different background color:
.progress-bar__progress {
/* Different background color */
background-color: #3b82f6;

/* Rounded border */
border-radius: 9999px;


We are going to position the inner bar absolutely to the container. The inner bar also occupies the half-width of its container:
.progress-bar {
position: relative;

.progress-bar__progress {
/* Absolute position */
position: absolute;
bottom: 0;
top: 0;

width: 50%;
To make the inner bar move from the left to the right side, we will use multiple keyframes indicating its positions at the beginning and end times:
@keyframes indeterminate {
from {
left: -50%;
to {
left: 100%;
Finally, run the animation without any delay:
.progress-bar__progress {
animation-duration: 2s;
animation-iteration-count: infinite;
animation-name: indeterminate;
The `animation-iteration-count: infinite` declaration tells the browser that the animation will loop forever, making the indeterminate effect.

See also

Questions? 🙋

Do you have any questions? Not just about this specific post, but about any topic in front-end development that you'd like to learn more about? If so, feel free to send me a message on Twitter or send me an email. You can find them at the bottom of this page.
I have a long list of upcoming posts, but your questions or ideas for the next one will be my top priority. Let's learn together! Sharing knowledge is the best way to grow 🥷.

Recent posts ⚡

Newsletter 🔔

If you're into front-end technologies and you want to see more of the content I'm creating, then you might want to consider subscribing to my newsletter.
By subscribing, you'll be the first to know about new articles, products, and exclusive promotions.
Don't worry, I won't spam you. And if you ever change your mind, you can unsubscribe at any time.
Phước Nguyễn