Close Menu

    Subscribe to Updates

    Get the latest creative news from FooBar about art, design and business.

    What's Hot

    How to create Awesome Cool Loading Animation using HTML CSS and JS

    16 June 2025

    How to create Login and Signup Form using HTML CSS and JS

    9 June 2025

    How to create Impossible light bulb using HTML CSS and JS

    5 June 2025
    Facebook X (Twitter) Instagram YouTube Telegram Threads
    Coding StellaCoding Stella
    • Home
    • Blog
    • HTML & CSS
      • Login Form
    • JavaScript
    • Hire us!
    Coding StellaCoding Stella
    Home - HTML & CSS - How to make Dots Ring Loader using HTML CSS
    HTML & CSS

    How to make Dots Ring Loader using HTML CSS

    Coding StellaBy Coding Stella16 April 2024No Comments4 Mins Read
    Share Facebook Twitter Pinterest LinkedIn Tumblr Reddit Email WhatsApp Copy Link

    Let’s create a simple Dots Ring Loader using HTML and CSS. This loader will consist of animated dots forming a ring, providing a visually appealing loading indicator for websites or applications.

    We’ll keep it minimalistic yet dynamic, using HTML to structure the loader and CSS to style and animate the dots.

    Let’s get started by crafting the Dots Ring Loader. Whether you’re a beginner or an experienced developer, this project offers a straightforward introduction to creating loaders with HTML and CSS.

    Let’s make the loading experience more engaging with a stylish dots ring animation!

    HTML :

    This HTML code creates a webpage with a loader animation consisting of dots and a ring. It links to an external CSS file for styling. The loader animation is represented by <div> elements with specific class names.

    <!DOCTYPE html>
    <html lang="en" >
    <head>
      <meta charset="UTF-8">
      <title>Dots & Ring Loader - CSS</title>
      <link rel="stylesheet" href="./style.css">
    
    </head>
    <body>
    <!-- partial:index.partial.html -->
    <input type="checkbox"/>
    <div class="bg"></div>
    <div class="dots">
      <div class="dot"></div>
      <div class="dot"></div>
      <div class="dot"></div>
      <div class="dot"></div>
      <div class="dot"></div>
      <div class="dot"></div>
      <div class="dot"></div>
      <div class="dot"></div>
      <div class="dot"></div>
      <div class="dot"></div>
      <div class="dot"></div>
      <div class="dot"></div>
      <div class="ring"></div>
    </div>
    <!-- partial -->
      
    </body>
    </html>
    

    CSS :

    This CSS code sets up the styling for a loader animation. It defines colors, durations, and animations for dots and a ring. The animation includes rotating dots, expanding dots, and changing the stacking order of the ring.

    :root {
      --w: #fafafa;
      --b: #141414;
      --s: 1s;
      --d: calc(var(--s) / 6);
    }
    
    * {
      box-sizing: border-box;
    }
    
    body {
      margin: 0;
      padding: 0;
      width: 100vw;
      height: 100vh;
      overflow: hidden;
    }
    
    input {
      width: 100vw;
      height: 100vh;
      position: absolute;
      z-index: 4;
      opacity: 0;
      cursor: pointer;
    }
    input:checked ~ div {
      filter: invert(1);
    }
    input:checked + .bg:before {
      content: "CLICK FOR DARK";
    }
    
    .bg:before {
      content: "CLICK FOR LIGHT";
      position: absolute;
      color: var(--w);
      width: 100%;
      text-align: center;
      bottom: 10vh;
      font-family: Arial, Helvetica, serif;
      font-size: 12px;
      text-shadow: 0 0 1px var(--w);
      opacity: 0.25;
    }
    
    body, .dots {
      display: flex;
      align-items: center;
      justify-content: center;
    }
    
    .bg {
      width: 100vw;
      height: 100vh;
      position: absolute;
      background: var(--b);
      z-index: -2;
    }
    
    .dots {
      width: 50vmin;
      height: 50vmin;
      position: relative;
    }
    
    .ring {
      border: 1.5vmin solid var(--w);
      width: 64%;
      height: 64%;
      border-radius: 100%;
      z-index: 0;
      box-shadow: 0 0 0 1vmin var(--b), 0 0 0 1vmin var(--b) inset;
    }
    
    .dot {
      width: 50%;
      position: absolute;
      height: 7vmin;
      left: 0;
      transform-origin: 100% 50%;
      z-index: -1;
      animation: over-ring calc(var(--s) * 2) linear 0s infinite, spin calc(var(--s) * 8) linear 0s infinite;
    }
    .dot:before {
      content: "";
      width: 5.5vmin;
      height: 5.5vmin;
      left: 0;
      box-sizing: border-box;
      border: 1vmin solid var(--b);
      position: absolute;
      background: var(--w);
      border-radius: 100%;
      animation: ball var(--s) ease-in-out 0s infinite alternate;
    }
    .dot:nth-child(1) {
      animation-delay: calc(var(--d) * 0), calc(var(--d) * 0);
    }
    .dot:nth-child(1):before {
      animation-delay: calc(var(--d) * 0);
    }
    .dot:nth-child(2) {
      animation-delay: calc(var(--d) * -1), calc(var(--d) * -4);
    }
    .dot:nth-child(2):before {
      animation-delay: calc(var(--d) * -1);
    }
    .dot:nth-child(3) {
      animation-delay: calc(var(--d) * -2), calc(var(--d) * -8);
    }
    .dot:nth-child(3):before {
      animation-delay: calc(var(--d) * -2);
    }
    .dot:nth-child(4) {
      animation-delay: calc(var(--d) * -3), calc(var(--d) * -12);
    }
    .dot:nth-child(4):before {
      animation-delay: calc(var(--d) * -3);
    }
    .dot:nth-child(5) {
      animation-delay: calc(var(--d) * -4), calc(var(--d) * -16);
    }
    .dot:nth-child(5):before {
      animation-delay: calc(var(--d) * -4);
    }
    .dot:nth-child(6) {
      animation-delay: calc(var(--d) * -5), calc(var(--d) * -20);
    }
    .dot:nth-child(6):before {
      animation-delay: calc(var(--d) * -5);
    }
    .dot:nth-child(7) {
      animation-delay: calc(var(--d) * -6), calc(var(--d) * -24);
    }
    .dot:nth-child(7):before {
      animation-delay: calc(var(--d) * -6);
    }
    .dot:nth-child(8) {
      animation-delay: calc(var(--d) * -7), calc(var(--d) * -28);
    }
    .dot:nth-child(8):before {
      animation-delay: calc(var(--d) * -7);
    }
    .dot:nth-child(9) {
      animation-delay: calc(var(--d) * -8), calc(var(--d) * -32);
    }
    .dot:nth-child(9):before {
      animation-delay: calc(var(--d) * -8);
    }
    .dot:nth-child(10) {
      animation-delay: calc(var(--d) * -9), calc(var(--d) * -36);
    }
    .dot:nth-child(10):before {
      animation-delay: calc(var(--d) * -9);
    }
    .dot:nth-child(11) {
      animation-delay: calc(var(--d) * -10), calc(var(--d) * -40);
    }
    .dot:nth-child(11):before {
      animation-delay: calc(var(--d) * -10);
    }
    .dot:nth-child(12) {
      animation-delay: calc(var(--d) * -11), calc(var(--d) * -44);
    }
    .dot:nth-child(12):before {
      animation-delay: calc(var(--d) * -11);
    }
    
    @keyframes spin {
      100% {
        transform: rotate(-360deg);
      }
    }
    @keyframes ball {
      100% {
        left: 12vmin;
        width: 4vmin;
        height: 4vmin;
      }
    }
    @keyframes over-ring {
      0%, 50% {
        z-index: -1;
      }
      51%, 100% {
        z-index: 1;
      }
    }

    In short, crafting a Dots Ring Loader using HTML and CSS has been a quick and effective way to create a visually appealing loading animation. By combining HTML for structure and CSS for styling and animation, we’ve achieved a dynamic loading indicator for websites or applications.

    If your project has problems, don’t worry. Just click to download the source code and face your coding challenges with excitement. Have fun coding!

    loader loading
    Share. Copy Link Twitter Facebook LinkedIn Email WhatsApp
    Previous ArticleHow to make Flip A Coin using HTML CSS & JavaScript
    Next Article How to make Monster Alien Star Rating using HTML CSS & JavaScript
    Coding Stella
    • Website

    Related Posts

    HTML & CSS

    How to create Awesome Cool Loading Animation using HTML CSS and JS

    16 June 2025
    HTML & CSS

    How to Create Animated Bicycle Product Card using HTML & CSS

    1 June 2025
    HTML & CSS

    How to make Happy birthday cake Animation using HTML & CSS

    29 May 2025
    Add A Comment
    Leave A Reply Cancel Reply

    Trending Post

    Master Frontend in 100 Days Ebook

    2 March 202419K Views

    How to make Modern Login Form using HTML & CSS | Glassmorphism

    11 January 202417K Views

    How to make I love you Animation in HTML CSS & JavaScript

    14 February 202415K Views

    How to make Valentine’s Day Card using HTML & CSS

    13 February 202412K Views
    Follow Us
    • Instagram
    • Facebook
    • YouTube
    • Twitter
    ads
    Featured Post

    How to create Password Validator using HTML CSS & JavaScript

    30 October 2024

    Top 5 Most Demanding Programming Language

    25 January 2024

    How to make Parallax depth cards using HTML CSS & JS

    23 August 2024

    Master Frontend in 100 Days Ebook

    2 March 2024
    Latest Post

    How to create Awesome Cool Loading Animation using HTML CSS and JS

    16 June 2025

    How to create Login and Signup Form using HTML CSS and JS

    9 June 2025

    How to create Impossible light bulb using HTML CSS and JS

    5 June 2025

    How to create Animated Rubik Cube using HTML CSS and JS

    3 June 2025
    Facebook X (Twitter) Instagram YouTube
    • About Us
    • Privacy Policy
    • Return and Refund Policy
    • Terms and Conditions
    • Contact Us
    • Buy me a coffee
    © 2025 Coding Stella. Made with 💙 by @coding.stella

    Type above and press Enter to search. Press Esc to cancel.

    Ad Blocker Enabled!
    Ad Blocker Enabled!
    Looks like you're using an ad blocker. We rely on advertising to help fund our site.
    Okay! I understood