Close Menu

    Subscribe to Updates

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

    What's Hot

    How to create Animated Social Media Card Hover using HTML CSS and JS

    20 October 2025

    How to create Animated LogOut Button using HTML CSS and JS

    18 October 2025

    How to create Animated Firework Diwali using HTML CSS and JS

    16 October 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 make Animated Electric Card using HTML & CSS

    4 October 2025
    HTML & CSS

    How to make Next Level Electric Button Animation using HTML & CSS

    2 October 2025
    HTML & CSS

    How to make Animated Chair Product Page using HTML & CSS

    30 September 2025
    Add A Comment
    Leave A Reply Cancel Reply

    Trending Post

    Master Frontend in 100 Days Ebook

    2 March 202429K Views

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

    11 January 202426K Views

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

    14 February 202421K Views

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

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

    How to make Parallax depth cards using HTML CSS & JS

    23 August 2024

    How to make Shoes Product Card Animation using HTML & CSS

    1 March 2025

    How to make Fancy Glowing Button using HTML & CSS

    24 July 2024

    How to make Animated Login form with Changing Background in HTML & CSS

    14 December 2023
    Latest Post

    How to create Animated Social Media Card Hover using HTML CSS and JS

    20 October 2025

    How to create Animated LogOut Button using HTML CSS and JS

    18 October 2025

    How to create Animated Firework Diwali using HTML CSS and JS

    16 October 2025

    How to create Escape Road Game using HTML CSS and JS

    14 October 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