Close Menu

    Subscribe to Updates

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

    What's Hot

    How to make Happy birthday cake Animation using HTML & CSS

    29 May 2025

    How to create Toast Catcher Game using HTML CSS and JS

    26 May 2025

    How to create Animated No Chill Login form using HTML CSS and JS

    22 May 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 3D Dot Preloader using HTML & CSS
    HTML & CSS

    How to make 3D Dot Preloader using HTML & CSS

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

    Let’s create a 3D Dot Preloader using HTML and CSS. This preloader will display animated dots in a 3D style to provide a visually appealing loading indicator for your web pages.

    We’ll use HTML to structure the preloader and CSS to style and animate the dots to achieve the 3D effect.

    Let’s get started on building the 3D Dot Preloader. Whether you’re a beginner or an experienced developer, this project offers a great way to practice your web design skills and create an engaging loading indicator. Let’s add some stylish loading animations to our projects!

    HTML :

    This HTML code creates a basic web page with a 3D dot preloader using only CSS for styling. It defines a document with the necessary metadata and links to an external stylesheet (style.css). The body of the document contains a div with the class pl, which serves as a container for four inner div elements, each representing a dot with classes pl__dot and additional unique classes (pl__dot--a, pl__dot--b, pl__dot--c, pl__dot--d). These dots will be styled and animated using CSS to create a loading animation effect.

    <!DOCTYPE html>
    <html lang="en" >
    <head>
      <meta charset="UTF-8">
      <title>3D Dot Preloader (pure CSS)</title>
      <meta name="viewport" content="width=device-width, initial-scale=1"><link rel="stylesheet" href="./style.css">
    
    </head>
    <body>
    <!-- partial:index.partial.html -->
    <div class="pl">
    	<div class="pl__dot pl__dot--a"></div>
    	<div class="pl__dot pl__dot--b"></div>
    	<div class="pl__dot pl__dot--c"></div>
    	<div class="pl__dot pl__dot--d"></div>
    </div>
    <!-- partial -->
      
    </body>
    </html>
    

    CSS :

    This CSS code defines styles for a webpage that features a 3D dot preloader animation. It begins with a reset of default browser styles using the universal selector (*). The :root pseudo-class sets CSS variables for colors, transition durations, and responsive font sizes. The .pl class styles the preloader container with 3D transformation properties. Each .pl__dot class applies general styles for the dots, including size, position, and animation settings. The specific dot classes (.pl__dot--a, .pl__dot--b, .pl__dot--c, .pl__dot--d) set individual colors and shadows for the dots. Finally, keyframe animations (@keyframes) are defined to create complex 3D rotational and translational movements for each dot, giving the appearance of a dynamic preloading animation.

    * {
      border: 0;
      box-sizing: border-box;
      margin: 0;
      padding: 0;
    }
    
    :root {
      --hue: 223;
      --bg: hsl(var(--hue),10%,5%);
      --fg: hsl(var(--hue),10%,95%);
      --dot-a: 313;
      --dot-b: 253;
      --dot-c: 223;
      --dot-d: 283;
      --trans-dur: 0.3s;
      font-size: calc(14px + (30 - 14) * (100vw - 280px) / (3840 - 280));
    }
    
    body {
      background-color: var(--bg);
      color: var(--fg);
      display: flex;
      font: 1em/1.5 sans-serif;
      height: 100vh;
      transition: background-color var(--trans-dur), color var(--trans-dur);
    }
    
    .pl {
      margin: auto;
      perspective: 18em;
      position: relative;
      width: 9em;
      height: 9em;
      transform-style: preserve-3d;
    }
    .pl__dot {
      animation-duration: 3s;
      animation-timing-function: cubic-bezier(0.37, 0, 0.63, 1);
      animation-iteration-count: infinite;
      border-radius: 50%;
      position: absolute;
      top: calc(50% - 1.5em);
      left: calc(50% - 1.5em);
      width: 3em;
      height: 3em;
    }
    .pl__dot--a {
      animation-name: dot-a;
      background-color: hsl(var(--dot-a), 90%, 60%);
      box-shadow: -0.5em -0.5em 1em hsl(var(--dot-a), 90%, 30%) inset, 0.125em 0.125em 0.25em hsl(var(--dot-a), 90%, 60%) inset, -0.25em -0.25em 0.75em 0.75em hsl(var(--dot-a), 90%, 50%) inset, 0.75em 0.75em 0.75em hsla(var(--hue), 10%, 5%, 0.7);
    }
    .pl__dot--b {
      animation-name: dot-b;
      background-color: hsl(var(--dot-b), 90%, 60%);
      box-shadow: -0.5em -0.5em 1em hsl(var(--dot-b), 90%, 30%) inset, 0.125em 0.125em 0.25em hsl(var(--dot-b), 90%, 60%) inset, -0.25em -0.25em 0.75em 0.75em hsl(var(--dot-b), 90%, 50%) inset, 0.75em 0.75em 0.75em hsla(var(--hue), 10%, 5%, 0.7);
    }
    .pl__dot--c {
      animation-name: dot-c;
      background-color: hsl(var(--dot-c), 90%, 60%);
      box-shadow: -0.5em -0.5em 1em hsl(var(--dot-c), 90%, 30%) inset, 0.125em 0.125em 0.25em hsl(var(--dot-c), 90%, 60%) inset, -0.25em -0.25em 0.75em 0.75em hsl(var(--dot-c), 90%, 50%) inset, 0.75em 0.75em 0.75em hsla(var(--hue), 10%, 5%, 0.7);
    }
    .pl__dot--d {
      animation-name: dot-d;
      background-color: hsl(var(--dot-d), 90%, 60%);
      box-shadow: -0.5em -0.5em 1em hsl(var(--dot-d), 90%, 30%) inset, 0.125em 0.125em 0.25em hsl(var(--dot-d), 90%, 60%) inset, -0.25em -0.25em 0.75em 0.75em hsl(var(--dot-d), 90%, 50%) inset, 0.75em 0.75em 0.75em hsla(var(--hue), 10%, 5%, 0.7);
    }
    
    /* Animations */
    @keyframes dot-a {
      from {
        transform: rotateY(0) rotateZ(0) translateX(-100%) rotateY(0) rotateZ(0);
      }
      50% {
        transform: rotateY(1turn) rotateZ(0) translateX(-100%) rotateY(-1turn) rotateZ(0);
      }
      to {
        transform: rotateY(1turn) rotateZ(-1turn) translateX(-100%) rotateY(-1turn) rotateZ(1turn);
      }
    }
    @keyframes dot-b {
      from {
        transform: rotateY(0) rotateZ(0) translateX(100%) rotateY(0) rotateZ(0);
      }
      50% {
        transform: rotateY(1turn) rotateZ(0) translateX(100%) rotateY(-1turn) rotateZ(0);
      }
      to {
        transform: rotateY(1turn) rotateZ(-1turn) translateX(100%) rotateY(-1turn) rotateZ(1turn);
      }
    }
    @keyframes dot-c {
      from {
        transform: rotateZ(0) rotateX(0) translateY(-100%) rotateZ(0) rotateX(0);
      }
      50% {
        transform: rotateZ(-1turn) rotateX(0) translateY(-100%) rotateZ(1turn) rotateX(0);
      }
      to {
        transform: rotateZ(-1turn) rotateX(1turn) translateY(-100%) rotateZ(1turn) rotateX(-1turn);
      }
    }
    @keyframes dot-d {
      from {
        transform: rotateZ(0) rotateX(0) translateY(100%) rotateZ(0) rotateX(0);
      }
      50% {
        transform: rotateZ(-1turn) rotateX(0) translateY(100%) rotateZ(1turn) rotateX(0);
      }
      to {
        transform: rotateZ(-1turn) rotateX(1turn) translateY(100%) rotateZ(1turn) rotateX(-1turn);
      }
    }

    In conclusion, creating a 3D Dot Preloader using HTML and CSS has been a fun and educational project. By combining HTML for structure and CSS for styling and animations, we’ve crafted a visually engaging loading indicator that adds a touch of elegance to the user experience. This project is perfect for enhancing your web designs with modern and interactive elements.

    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!

    Share. Copy Link Twitter Facebook LinkedIn Email WhatsApp
    Previous ArticleHow to make On-Scroll Fire Transition effect using HTML CSS & JavaScript
    Next Article How to make Sort the bubble clock using HTML CSS & JavaScript
    Coding Stella
    • Website

    Related Posts

    HTML & CSS

    How to make Happy birthday cake Animation using HTML & CSS

    29 May 2025
    HTML & CSS

    How to make Social media icons hover effect using HTML & CSS

    14 May 2025
    HTML & CSS

    How to make Awesome Radar Animation using HTML & CSS

    8 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 202416K Views

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

    14 February 202414K 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 Merry Christmas Cannon Animation using HTML CSS & JavaScript

    24 December 2024

    How to make Hourglass Preloader using HTML & CSS

    9 April 2025

    How to make Hand Scanning Animation using HTML & CSS

    12 January 2024

    How to make Login and Signup Form using HTML CSS & JavaScript

    14 January 2024
    Latest Post

    How to make Happy birthday cake Animation using HTML & CSS

    29 May 2025

    How to create Toast Catcher Game using HTML CSS and JS

    26 May 2025

    How to create Animated No Chill Login form using HTML CSS and JS

    22 May 2025

    How to make Social media icons hover effect using HTML & CSS

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