Indeterminate Circular Progress Bar using Pure CSS

indeterminate progress bar css

This is an indeterminate circle progress bar using pure HTML & CSS. It doesn’t use JavaScript. It uses conic-gradient to create the gradient effect. It also uses animation property to animate the progress bar.

Final output:

If the video isn’t working, watch it on the YouTube.

Helpful links to understand the code:

Here is the source code:

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>Loading Bar</title>
    <link rel="stylesheet" href="./styles.css">
</head>
<body>
    <div class="outer-circle">
        <div class="inner-circle">
            
        </div>
    </div>
</body>
</html>

CSS:

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

.outer-circle {
    width: 5rem;
    height: 5rem;
    background-color: #fff;
    margin: auto;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 50%;
}

.inner-circle {
    border-radius: inherit;
    background-image: conic-gradient(#fff, rgba(80,200,120,0.3), rgb(80,200,120));
    position: absolute;
    z-index: -1;
    margin: auto;
    top: -0.8rem;
    bottom: -0.8rem;
    left: -0.8rem;
    right: -0.8rem;
    animation: circle-anim 0.6s linear infinite;
}

@keyframes circle-anim {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

Leave a Comment