fbpx
Friday, December 8, 2023
Hire us on Freelancer.com for web development service
HomeHtml & CssHow to Create Loading spinner with CSS

How to Create Loading spinner with CSS

Creating a CSS loading spinner can add visual interest to your website while indicating to users that something is loading or processing. In today’s web development landscape, where the customer experience is everything, website loading speed plays an important role in the user experience. Slow-loading websites can drive visitors away, leading to higher bounce rates and lower rankings in search engines. To enhance user engagement and reduce bounce rates, website owners often use CSS loader animations.

A CSS loading spinner is a dynamic way to engage your website visitors while they wait for content to load. These aesthetically pleasing animations not only enhance the user experience but also reflect your site’s design prowess. To enhance user engagement and reduce bounce rates, website owners often use CSS loader animations. In this article, we’ll show you how to create a captivating CSS loading spinner, exploring techniques, design principles, and best practices to craft captivating loading indicators.

Learn why to create a CSS loading spinner.

Before we dive into the creation process, it’s crucial to grasp the essence of CSS loaders and their significance in web development.

CSS loaders, also known as spinners or loading indicators, are visual cues that inform users about ongoing processes, such as data retrieval or page loading. These animations not only provide feedback but also serve as delightful embellishments to your web interface.

Source Code:
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>create css loader animation</title>

    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-4bw+/aepP/YC94hEpVNVgiZdgIC5+VKNBQNGCHeKRQN+PtmoHDEXuppvnDJzQIu9" crossorigin="anonymous">

    <style type="text/css">
        
        .bounce1, .bounce2, .bounce3 {
          width: 20px;
          height: 20px;
          background-color: #007bff;
          border-radius: 50%;
          display: inline-block;
          animation: bounce 1.4s infinite ease-in-out both;
        }

        .bounce2 {
          animation-delay: 0.2s;
        }

        .bounce3 {
          animation-delay: 0.4s;
        }

        @keyframes bounce {
          0%, 80%, 100% {
            transform: scale(0);
          }

          40% {
            transform: scale(1);
          }
        }





        


        .rotating-loader {
          border: 4px solid #3498db;
          border-top: 4px solid #e74c3c;
          border-radius: 50%;
          width: 40px;
          height: 40px;
          animation: spin 2s linear infinite;
        }

        @keyframes spin {
          0% { transform: rotate(0deg); }
          100% { transform: rotate(360deg); }
        }


        .pulse-loader {
          width: 32px;
          height: 32px;
          background-color: #e74c3c;
          border-radius: 50%;
          animation: pulse 1.5s infinite;
        }

        @keyframes pulse {
          0%, 100% { transform: scale(1); }
          50% { transform: scale(1.2); }
        }



        .loader-03 {
              border: 4px solid rgba(255, 255, 255, 0.3);
              border-top: 4px solid #3498db;
              border-radius: 50%;
              width: 40px;
              height: 40px;
              animation: spin 0.5s linear infinite;
            }

        .loader3 {
          margin: 0 auto;
          display: block;
        }

        @keyframes spin {
          0% { transform: rotate(0deg); }
          100% { transform: rotate(360deg); }
        }


        .loader-04 {
          width: 40px;
          height: 40px;
          background-color: #e74c3c;
          border-radius: 50%;
          position: relative;
          animation: bounce 2s infinite;
        }

        @keyframes bounce {
          0%, 20%, 50%, 80%, 100% {
            transform: translateY(0);
          }
          40% {
            transform: translateY(-30px);
          }
        }

        .loader-05 {
          width: 40px;
          height: 40px;
          background-color: #27ae60;
          border-radius: 50%;
          animation: pulse 1s infinite;
        }

        @keyframes pulse {
          0%, 100% {
            transform: scale(1);
          }
          50% {
            transform: scale(1.2);
          }
        }

        .loader-06 {
          display: flex;
          justify-content: center;
          align-items: center;
          height: 40px;
        }

        .dot {
          width: 10px;
          height: 10px;
          background-color: #9b59b6;
          border-radius: 50%;
          margin: 0 5px;
          animation: fade 1.5s infinite;
        }

        .dot1 { animation-delay: 0s; }
        .dot2 { animation-delay: 0.5s; }
        .dot3 { animation-delay: 1s; }

        @keyframes fade {
          0%, 100% {
            opacity: 0.5;
          }
          50% {
            opacity: 1;
          }
        }

        .loader-07 {
          width: 40px;
          height: 40px;
          background-color: #3498db;
          border-radius: 50%;
          position: relative;
          animation: glow 1.5s infinite;
        }

        @keyframes glow {
          0%, 100% {
            box-shadow: 0 0 10px #3498db;
          }
          50% {
            box-shadow: 0 0 20px #3498db;
          }
        }



    </style>
</head>
<body>

    <div class="d-flex justify-content-center align-items-center aligin-self-center mt-5 mb-5">

        <div class="bounce1"></div>
      	<div class="bounce2"></div>
      	<div class="bounce3"></div>

    </div>

    <div class="d-flex justify-content-center align-items-center aligin-self-center mt-5 mb-5">	

        <div class="loader-01 rotating-loader"></div>

    </div>

    <div class="d-flex justify-content-center align-items-center aligin-self-center mt-5 mb-5">	

        <div class="loader-02 pulse-loader"></div>

    </div>

    <div class="d-flex justify-content-center align-items-center aligin-self-center mt-5 mb-5">	

        <div class="loader-03 loader3"></div>

    </div>

    <div class="d-flex justify-content-center align-items-center aligin-self-center mt-5 mb-5">	

        <div class="loader-04 loader4"></div>

    </div>

    <div class="d-flex justify-content-center align-items-center aligin-self-center mt-5 mb-5">	

        <div class="loader-05 loader5"></div>

    </div>

    <div class="d-flex justify-content-center align-items-center aligin-self-center mt-5 mb-5">	

        <div class="loader-06 loader6">

            <div class="dot dot1"></div>
          	<div class="dot dot2"></div>
          	<div class="dot dot3"></div>
            

        </div>
        

    </div>

    <div class="d-flex justify-content-center align-items-center aligin-self-center mt-5 mb-5">	

        <div class="loader-07 loader7"></div>

    </div>

</body>
</html>

 

To further improve your website’s user experience, consider implementing additional features like a “Scroll Back to Top” button, which can easily be added by following the guide provided in this article.

Conclusion

Incorporating CSS loader animations not only enhances the visual appeal of your website but also keeps users engaged during the loading process. By following the steps outlined above, you can create a seamless and captivating user experience that encourages visitors to stay on your site.

In conclusion, CSS loader animations are a powerful way to make your website stand out and provide an engaging experience for your users. Start implementing these techniques today and watch your website’s user engagement soar.

 

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Hire Us

Categories