Sun Jul 17 2022

Horizontal Loading Bar Animation

CSS4960 views

File Name: Horizonatal-loading-bar.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>Horizontal Loading Bar Animation</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }

        body {
            background-color: #292929;
        }

        section {
            display: flex;
            width: 100%;
            height: 100vh;
            justify-content: center;
            align-items: center;
        }

        ul#loadingBar {
            width: 300px;
            list-style: none;
        }

        ul#loadingBar li {
            width: 5%;
            height: 5px;
            background-color: rgba(255,255,255,0.5);
            margin: 20px 0;
            border-radius: 20px;
            animation: loader 5s linear infinite;
        }

        ul#loadingBar li:nth-child(1) {
            animation-delay: 0.3s;
        }

        ul#loadingBar li:nth-child(2) {
            animation-delay: 0.5s;
        }

        ul#loadingBar li:nth-child(3) {
            animation-delay: 0.8s;
        }

        ul#loadingBar li:nth-child(4) {
            animation-delay: 0.2s;
        }

        ul#loadingBar li:nth-child(5) {
            animation-delay: 0.9s;
        }

        ul#loadingBar li:nth-child(6) {
            animation-delay: 0.1s;
        }

        ul#loadingBar li:nth-child(7) {
            animation-delay: 0.8s;
        }

        ul#loadingBar li:nth-child(8) {
            animation-delay: 0.4s;
        }

        @keyframes loader {
            0% {
                width: 10%;
            }

            30% {
                width: 70%;
            }

            50% {
                width: 30%;
            }

            65% {
                width: 90%;
            }

            85% {
                width: 100%;
                background-color: rgba(250,121,0,0.5);
            }

            100% {
                width: 5%;
            }
        }
        
    </style>
</head>
<body>
    <section>
        <ul id="loadingBar">
            <li></li>
            <li></li>
            <li></li>
            <li></li>
            <li></li>
            <li></li>
            <li></li>
            <li></li>
        </ul>
    </section>
</body>
</html>

Result Screenshot(s)

Horizontal Loading Bar AnimationWorking Sample0

We use cookies to improve your experience on our site and to show you personalised advertising. Please read our cookie policy and privacy policy.