Easy and Quick Single DIV Spinning Dots Loading Status Animation using Vanilla CSS Only

If you prefer video over text then there is a YouTube video at the end of the article. Let’s go step-by-step and build our loading animation.

Step-1: Setting up theme

Let’s first set up the theme and position our animation.

<div c…


This content originally appeared on DEV Community and was authored by Designing Coder

If you prefer video over text then there is a YouTube video at the end of the article. Let's go step-by-step and build our loading animation.

Step-1: Setting up theme

Let's first set up the theme and position our animation.

    <div class="loading"></div>
    body {
      width: 100vw;
      height: 100vh;
      overflow: hidden;
      display: flex;
      background: midnightblue;
      justify-content: center;
      align-items: center;
    }
    .loading {
      width: 1.5em;
      height: 1.5em;
      border-radius: 50%;
        background: white;
    }

The circle you see is for the reference, we will remove it later.

Step-2: Adding the dots

We will use box-shadow which will help us add more circles or dots without adding any extra div. We will position them around our previous circle.

     .loader {
         ...
      box-shadow:
            0 -3em 0rgba(255, 255, 255, 1),
            2.25em -2.25em rgba(255, 255, 255, 0.875),
            3em 0 rgba(255, 255, 255, 0.75),
            2.25em 2.25em rgba(255, 255, 255, 0.625),
            0 3em rgba(255, 255, 255, 0.5),
            -2.25em 2.25em rgba(255, 255, 255, 0.375),
            -3em 0 rgba(255, 255, 255, 0.25),
            -2.25em -2.25em rgba(255, 255, 255, 0.125)
            ;
    }

We no longer need the first circle(background: white;), we can remove it.

Step-3: Animation

We just need to the div to keep rotating as per our need, which is a one-liner coder.

    .loading {
        ...
      animation: spin 1.2s linear infinite;
    }

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

We have our single div loading status animation ready. Thank you for reading.

Please feel free to drop you opinion or any helpful tips.

Feel free to connect on Social Media: https://designingcoder.github.io


This content originally appeared on DEV Community and was authored by Designing Coder


Print Share Comment Cite Upload Translate Updates
APA

Designing Coder | Sciencx (2021-10-14T05:45:38+00:00) Easy and Quick Single DIV Spinning Dots Loading Status Animation using Vanilla CSS Only. Retrieved from https://www.scien.cx/2021/10/14/easy-and-quick-single-div-spinning-dots-loading-status-animation-using-vanilla-css-only/

MLA
" » Easy and Quick Single DIV Spinning Dots Loading Status Animation using Vanilla CSS Only." Designing Coder | Sciencx - Thursday October 14, 2021, https://www.scien.cx/2021/10/14/easy-and-quick-single-div-spinning-dots-loading-status-animation-using-vanilla-css-only/
HARVARD
Designing Coder | Sciencx Thursday October 14, 2021 » Easy and Quick Single DIV Spinning Dots Loading Status Animation using Vanilla CSS Only., viewed ,<https://www.scien.cx/2021/10/14/easy-and-quick-single-div-spinning-dots-loading-status-animation-using-vanilla-css-only/>
VANCOUVER
Designing Coder | Sciencx - » Easy and Quick Single DIV Spinning Dots Loading Status Animation using Vanilla CSS Only. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2021/10/14/easy-and-quick-single-div-spinning-dots-loading-status-animation-using-vanilla-css-only/
CHICAGO
" » Easy and Quick Single DIV Spinning Dots Loading Status Animation using Vanilla CSS Only." Designing Coder | Sciencx - Accessed . https://www.scien.cx/2021/10/14/easy-and-quick-single-div-spinning-dots-loading-status-animation-using-vanilla-css-only/
IEEE
" » Easy and Quick Single DIV Spinning Dots Loading Status Animation using Vanilla CSS Only." Designing Coder | Sciencx [Online]. Available: https://www.scien.cx/2021/10/14/easy-and-quick-single-div-spinning-dots-loading-status-animation-using-vanilla-css-only/. [Accessed: ]
rf:citation
» Easy and Quick Single DIV Spinning Dots Loading Status Animation using Vanilla CSS Only | Designing Coder | Sciencx | https://www.scien.cx/2021/10/14/easy-and-quick-single-div-spinning-dots-loading-status-animation-using-vanilla-css-only/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.