Close Menu

    Subscribe to Updates

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

    What's Hot

    How to make 3D Animated Box Loader using HTML and CSS

    20 February 2026

    How to Make Subway Super Hopper Game in HTML CSS & JavaScript

    15 February 2026

    How to make Magic Social Share Menu using HTML CSS and JS

    5 February 2026
    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 Animated Box Loader using HTML and CSS
    HTML & CSS

    How to make 3D Animated Box Loader using HTML and CSS

    Coding StellaBy Coding Stella20 February 2026No Comments11 Mins Read
    Share Facebook Twitter Pinterest LinkedIn Tumblr Reddit Email WhatsApp Copy Link

    Let’s create a 3D Animated Box Loader using HTML and CSS to build a stunning, eye catching loading animation. This loader uses smooth 3D transforms, scaling effects, and perfectly timed keyframe animations to make multiple cubes move in sequence and create a dynamic visual experience – perfect for modern websites, portfolios, or web apps.

    We’ll use:

    • HTML to structure the loader container, boxes, and ground element
    • CSS to design the 3D cubes, apply perspective, gradients, and lighting effects. CSS Keyframe Animations to control movement, scaling, rotation, and timing for a seamless looping effect

    Each box is animated with slightly different delays so they appear one by one, move to the center, bounce, and disappear smoothly. The ground element adds depth with a shine effect, making the entire loader feel realistic and polished.

    HTML :

    This HTML creates the structure for the 3D animated loader. The main .loader div is the container for everything. Inside it, there are 8 .box elements from box0 to box7, and each box contains one inner <div> that becomes a 3D cube using CSS transforms and animations. The different box class names allow each cube to have separate animation timing so they move in sequence. The .ground div with its inner <div> creates the animated floor effect under the cubes. The CSS handles all the 3D styling and animation, while this HTML only defines the layout structure.

    <!DOCTYPE html>
    <html lang="en">
    
    <head>
      <meta charset="UTF-8">
      <title>3D Animated Box Loader | @coding.stella</title>
      <link rel="stylesheet" href="https://public.codepenassets.com/css/reset-2.0.min.css">
      <link rel="stylesheet" href="./style.css">
    </head>
    
    <body>
      <div class="loader">
        <div class="box box0">
          <div></div>
        </div>
        <div class="box box1">
          <div></div>
        </div>
        <div class="box box2">
          <div></div>
        </div>
        <div class="box box3">
          <div></div>
        </div>
        <div class="box box4">
          <div></div>
        </div>
        <div class="box box5">
          <div></div>
        </div>
        <div class="box box6">
          <div></div>
        </div>
        <div class="box box7">
          <div></div>
        </div>
        <div class="ground">
          <div></div>
        </div>
      </div>
      <script src="./script.js"></script>
    
    </body>
    </html>

    CSS :

    This CSS creates a 3D animated loader using variables, transforms, and keyframes. It sets a dark background, centers everything using flexbox, and defines a .loader container with 3D perspective. Inside it, multiple .box elements act like small cubes that rotate in 3D using rotateX, rotateY, and rotateZ, then move and scale with different keyframe timings to create a smooth sequence effect. The ground element adds a floor with gradient shine animation, and pseudo elements like :before and :after help build cube faces and masking effects. Each box has slightly delayed animations so they appear one by one, move to the center, bounce, and disappear, making a continuous 3D loading animation.

    :root {
      --background: #121621;
    }
    
    html {
      box-sizing: border-box;
      -webkit-font-smoothing: antialiased;
    }
    
    *,
    *:before,
    *:after {
      box-sizing: inherit;
    }
    
    body {
      margin: 0;
      min-height: 100vh;
      display: flex;
      justify-content: center;
      align-items: center;
      background: var(--background);
    }
    
    .loader {
      --duration: 3s;
      --primary: rgba(39, 94, 254, 1);
      --primary-light: #2f71ff;
      --primary-rgba: rgba(39, 94, 254, 0);
      width: 200px;
      height: 320px;
      position: relative;
      transform-style: preserve-3d;
    }
    
    @media (max-width: 480px) {
      .loader {
        zoom: 0.44;
      }
    }
    
    .loader:before,
    .loader:after {
      --r: 20.5deg;
      content: "";
      width: 320px;
      height: 140px;
      position: absolute;
      right: 32%;
      bottom: -11px;
      background: var(--background);
      transform: translateZ(200px) rotate(var(--r));
      -webkit-animation: mask var(--duration) linear forwards infinite;
      animation: mask var(--duration) linear forwards infinite;
    }
    
    .loader:after {
      --r: -20.5deg;
      right: auto;
      left: 32%;
    }
    
    .loader .ground {
      position: absolute;
      left: -50px;
      bottom: -120px;
      transform-style: preserve-3d;
      transform: rotateY(-47deg) rotateX(-15deg) rotateZ(15deg) scale(1);
    }
    
    .loader .ground div {
      transform: rotateX(90deg) rotateY(0deg) translate(-48px, -120px) translateZ(100px) scale(0);
      width: 200px;
      height: 200px;
      background: var(--primary);
      background: linear-gradient(45deg, var(--primary) 0%, var(--primary) 50%, var(--primary-light) 50%, var(--primary-light) 100%);
      transform-style: preserve-3d;
      -webkit-animation: ground var(--duration) linear forwards infinite;
      animation: ground var(--duration) linear forwards infinite;
    }
    
    .loader .ground div:before,
    .loader .ground div:after {
      --rx: 90deg;
      --ry: 0deg;
      --x: 44px;
      --y: 162px;
      --z: -50px;
      content: "";
      width: 156px;
      height: 300px;
      opacity: 0;
      background: linear-gradient(var(--primary), var(--primary-rgba));
      position: absolute;
      transform: rotateX(var(--rx)) rotateY(var(--ry)) translate(var(--x), var(--y)) translateZ(var(--z));
      -webkit-animation: ground-shine var(--duration) linear forwards infinite;
      animation: ground-shine var(--duration) linear forwards infinite;
    }
    
    .loader .ground div:after {
      --rx: 90deg;
      --ry: 90deg;
      --x: 0;
      --y: 177px;
      --z: 150px;
    }
    
    .loader .box {
      --x: 0;
      --y: 0;
      position: absolute;
      -webkit-animation: var(--duration) linear forwards infinite;
      animation: var(--duration) linear forwards infinite;
      transform: translate(var(--x), var(--y));
    }
    
    .loader .box div {
      background-color: var(--primary);
      width: 48px;
      height: 48px;
      position: relative;
      transform-style: preserve-3d;
      -webkit-animation: var(--duration) ease forwards infinite;
      animation: var(--duration) ease forwards infinite;
      transform: rotateY(-47deg) rotateX(-15deg) rotateZ(15deg) scale(0);
    }
    
    .loader .box div:before,
    .loader .box div:after {
      --rx: 90deg;
      --ry: 0deg;
      --z: 24px;
      --y: -24px;
      --x: 0;
      content: "";
      position: absolute;
      background-color: inherit;
      width: inherit;
      height: inherit;
      transform: rotateX(var(--rx)) rotateY(var(--ry)) translate(var(--x), var(--y)) translateZ(var(--z));
      filter: brightness(var(--b, 1.2));
    }
    
    .loader .box div:after {
      --rx: 0deg;
      --ry: 90deg;
      --x: 24px;
      --y: 0;
      --b: 1.4;
    }
    
    .loader .box.box0 {
      --x: -220px;
      --y: -120px;
      left: 58px;
      top: 108px;
    }
    
    .loader .box.box1 {
      --x: -260px;
      --y: 120px;
      left: 25px;
      top: 120px;
    }
    
    .loader .box.box2 {
      --x: 120px;
      --y: -190px;
      left: 58px;
      top: 64px;
    }
    
    .loader .box.box3 {
      --x: 280px;
      --y: -40px;
      left: 91px;
      top: 120px;
    }
    
    .loader .box.box4 {
      --x: 60px;
      --y: 200px;
      left: 58px;
      top: 132px;
    }
    
    .loader .box.box5 {
      --x: -220px;
      --y: -120px;
      left: 25px;
      top: 76px;
    }
    
    .loader .box.box6 {
      --x: -260px;
      --y: 120px;
      left: 91px;
      top: 76px;
    }
    
    .loader .box.box7 {
      --x: -240px;
      --y: 200px;
      left: 58px;
      top: 87px;
    }
    
    .loader .box0 {
      -webkit-animation-name: box-move0;
      animation-name: box-move0;
    }
    
    .loader .box0 div {
      -webkit-animation-name: box-scale0;
      animation-name: box-scale0;
    }
    
    .loader .box1 {
      -webkit-animation-name: box-move1;
      animation-name: box-move1;
    }
    
    .loader .box1 div {
      -webkit-animation-name: box-scale1;
      animation-name: box-scale1;
    }
    
    .loader .box2 {
      -webkit-animation-name: box-move2;
      animation-name: box-move2;
    }
    
    .loader .box2 div {
      -webkit-animation-name: box-scale2;
      animation-name: box-scale2;
    }
    
    .loader .box3 {
      -webkit-animation-name: box-move3;
      animation-name: box-move3;
    }
    
    .loader .box3 div {
      -webkit-animation-name: box-scale3;
      animation-name: box-scale3;
    }
    
    .loader .box4 {
      -webkit-animation-name: box-move4;
      animation-name: box-move4;
    }
    
    .loader .box4 div {
      -webkit-animation-name: box-scale4;
      animation-name: box-scale4;
    }
    
    .loader .box5 {
      -webkit-animation-name: box-move5;
      animation-name: box-move5;
    }
    
    .loader .box5 div {
      -webkit-animation-name: box-scale5;
      animation-name: box-scale5;
    }
    
    .loader .box6 {
      -webkit-animation-name: box-move6;
      animation-name: box-move6;
    }
    
    .loader .box6 div {
      -webkit-animation-name: box-scale6;
      animation-name: box-scale6;
    }
    
    .loader .box7 {
      -webkit-animation-name: box-move7;
      animation-name: box-move7;
    }
    
    .loader .box7 div {
      -webkit-animation-name: box-scale7;
      animation-name: box-scale7;
    }
    
    @-webkit-keyframes box-move0 {
      12% {
        transform: translate(var(--x), var(--y));
      }
    
      25%,
      52% {
        transform: translate(0, 0);
      }
    
      80% {
        transform: translate(0, -32px);
      }
    
      90%,
      100% {
        transform: translate(0, 188px);
      }
    }
    
    @keyframes box-move0 {
      12% {
        transform: translate(var(--x), var(--y));
      }
    
      25%,
      52% {
        transform: translate(0, 0);
      }
    
      80% {
        transform: translate(0, -32px);
      }
    
      90%,
      100% {
        transform: translate(0, 188px);
      }
    }
    
    @-webkit-keyframes box-scale0 {
      6% {
        transform: rotateY(-47deg) rotateX(-15deg) rotateZ(15deg) scale(0);
      }
    
      14%,
      100% {
        transform: rotateY(-47deg) rotateX(-15deg) rotateZ(15deg) scale(1);
      }
    }
    
    @keyframes box-scale0 {
      6% {
        transform: rotateY(-47deg) rotateX(-15deg) rotateZ(15deg) scale(0);
      }
    
      14%,
      100% {
        transform: rotateY(-47deg) rotateX(-15deg) rotateZ(15deg) scale(1);
      }
    }
    
    @-webkit-keyframes box-move1 {
      16% {
        transform: translate(var(--x), var(--y));
      }
    
      29%,
      52% {
        transform: translate(0, 0);
      }
    
      80% {
        transform: translate(0, -32px);
      }
    
      90%,
      100% {
        transform: translate(0, 188px);
      }
    }
    
    @keyframes box-move1 {
      16% {
        transform: translate(var(--x), var(--y));
      }
    
      29%,
      52% {
        transform: translate(0, 0);
      }
    
      80% {
        transform: translate(0, -32px);
      }
    
      90%,
      100% {
        transform: translate(0, 188px);
      }
    }
    
    @-webkit-keyframes box-scale1 {
      10% {
        transform: rotateY(-47deg) rotateX(-15deg) rotateZ(15deg) scale(0);
      }
    
      18%,
      100% {
        transform: rotateY(-47deg) rotateX(-15deg) rotateZ(15deg) scale(1);
      }
    }
    
    @keyframes box-scale1 {
      10% {
        transform: rotateY(-47deg) rotateX(-15deg) rotateZ(15deg) scale(0);
      }
    
      18%,
      100% {
        transform: rotateY(-47deg) rotateX(-15deg) rotateZ(15deg) scale(1);
      }
    }
    
    @-webkit-keyframes box-move2 {
      20% {
        transform: translate(var(--x), var(--y));
      }
    
      33%,
      52% {
        transform: translate(0, 0);
      }
    
      80% {
        transform: translate(0, -32px);
      }
    
      90%,
      100% {
        transform: translate(0, 188px);
      }
    }
    
    @keyframes box-move2 {
      20% {
        transform: translate(var(--x), var(--y));
      }
    
      33%,
      52% {
        transform: translate(0, 0);
      }
    
      80% {
        transform: translate(0, -32px);
      }
    
      90%,
      100% {
        transform: translate(0, 188px);
      }
    }
    
    @-webkit-keyframes box-scale2 {
      14% {
        transform: rotateY(-47deg) rotateX(-15deg) rotateZ(15deg) scale(0);
      }
    
      22%,
      100% {
        transform: rotateY(-47deg) rotateX(-15deg) rotateZ(15deg) scale(1);
      }
    }
    
    @keyframes box-scale2 {
      14% {
        transform: rotateY(-47deg) rotateX(-15deg) rotateZ(15deg) scale(0);
      }
    
      22%,
      100% {
        transform: rotateY(-47deg) rotateX(-15deg) rotateZ(15deg) scale(1);
      }
    }
    
    @-webkit-keyframes box-move3 {
      24% {
        transform: translate(var(--x), var(--y));
      }
    
      37%,
      52% {
        transform: translate(0, 0);
      }
    
      80% {
        transform: translate(0, -32px);
      }
    
      90%,
      100% {
        transform: translate(0, 188px);
      }
    }
    
    @keyframes box-move3 {
      24% {
        transform: translate(var(--x), var(--y));
      }
    
      37%,
      52% {
        transform: translate(0, 0);
      }
    
      80% {
        transform: translate(0, -32px);
      }
    
      90%,
      100% {
        transform: translate(0, 188px);
      }
    }
    
    @-webkit-keyframes box-scale3 {
      18% {
        transform: rotateY(-47deg) rotateX(-15deg) rotateZ(15deg) scale(0);
      }
    
      26%,
      100% {
        transform: rotateY(-47deg) rotateX(-15deg) rotateZ(15deg) scale(1);
      }
    }
    
    @keyframes box-scale3 {
      18% {
        transform: rotateY(-47deg) rotateX(-15deg) rotateZ(15deg) scale(0);
      }
    
      26%,
      100% {
        transform: rotateY(-47deg) rotateX(-15deg) rotateZ(15deg) scale(1);
      }
    }
    
    @-webkit-keyframes box-move4 {
      28% {
        transform: translate(var(--x), var(--y));
      }
    
      41%,
      52% {
        transform: translate(0, 0);
      }
    
      80% {
        transform: translate(0, -32px);
      }
    
      90%,
      100% {
        transform: translate(0, 188px);
      }
    }
    
    @keyframes box-move4 {
      28% {
        transform: translate(var(--x), var(--y));
      }
    
      41%,
      52% {
        transform: translate(0, 0);
      }
    
      80% {
        transform: translate(0, -32px);
      }
    
      90%,
      100% {
        transform: translate(0, 188px);
      }
    }
    
    @-webkit-keyframes box-scale4 {
      22% {
        transform: rotateY(-47deg) rotateX(-15deg) rotateZ(15deg) scale(0);
      }
    
      30%,
      100% {
        transform: rotateY(-47deg) rotateX(-15deg) rotateZ(15deg) scale(1);
      }
    }
    
    @keyframes box-scale4 {
      22% {
        transform: rotateY(-47deg) rotateX(-15deg) rotateZ(15deg) scale(0);
      }
    
      30%,
      100% {
        transform: rotateY(-47deg) rotateX(-15deg) rotateZ(15deg) scale(1);
      }
    }
    
    @-webkit-keyframes box-move5 {
      32% {
        transform: translate(var(--x), var(--y));
      }
    
      45%,
      52% {
        transform: translate(0, 0);
      }
    
      80% {
        transform: translate(0, -32px);
      }
    
      90%,
      100% {
        transform: translate(0, 188px);
      }
    }
    
    @keyframes box-move5 {
      32% {
        transform: translate(var(--x), var(--y));
      }
    
      45%,
      52% {
        transform: translate(0, 0);
      }
    
      80% {
        transform: translate(0, -32px);
      }
    
      90%,
      100% {
        transform: translate(0, 188px);
      }
    }
    
    @-webkit-keyframes box-scale5 {
      26% {
        transform: rotateY(-47deg) rotateX(-15deg) rotateZ(15deg) scale(0);
      }
    
      34%,
      100% {
        transform: rotateY(-47deg) rotateX(-15deg) rotateZ(15deg) scale(1);
      }
    }
    
    @keyframes box-scale5 {
      26% {
        transform: rotateY(-47deg) rotateX(-15deg) rotateZ(15deg) scale(0);
      }
    
      34%,
      100% {
        transform: rotateY(-47deg) rotateX(-15deg) rotateZ(15deg) scale(1);
      }
    }
    
    @-webkit-keyframes box-move6 {
      36% {
        transform: translate(var(--x), var(--y));
      }
    
      49%,
      52% {
        transform: translate(0, 0);
      }
    
      80% {
        transform: translate(0, -32px);
      }
    
      90%,
      100% {
        transform: translate(0, 188px);
      }
    }
    
    @keyframes box-move6 {
      36% {
        transform: translate(var(--x), var(--y));
      }
    
      49%,
      52% {
        transform: translate(0, 0);
      }
    
      80% {
        transform: translate(0, -32px);
      }
    
      90%,
      100% {
        transform: translate(0, 188px);
      }
    }
    
    @-webkit-keyframes box-scale6 {
      30% {
        transform: rotateY(-47deg) rotateX(-15deg) rotateZ(15deg) scale(0);
      }
    
      38%,
      100% {
        transform: rotateY(-47deg) rotateX(-15deg) rotateZ(15deg) scale(1);
      }
    }
    
    @keyframes box-scale6 {
      30% {
        transform: rotateY(-47deg) rotateX(-15deg) rotateZ(15deg) scale(0);
      }
    
      38%,
      100% {
        transform: rotateY(-47deg) rotateX(-15deg) rotateZ(15deg) scale(1);
      }
    }
    
    @-webkit-keyframes box-move7 {
      40% {
        transform: translate(var(--x), var(--y));
      }
    
      53%,
      52% {
        transform: translate(0, 0);
      }
    
      80% {
        transform: translate(0, -32px);
      }
    
      90%,
      100% {
        transform: translate(0, 188px);
      }
    }
    
    @keyframes box-move7 {
      40% {
        transform: translate(var(--x), var(--y));
      }
    
      53%,
      52% {
        transform: translate(0, 0);
      }
    
      80% {
        transform: translate(0, -32px);
      }
    
      90%,
      100% {
        transform: translate(0, 188px);
      }
    }
    
    @-webkit-keyframes box-scale7 {
      34% {
        transform: rotateY(-47deg) rotateX(-15deg) rotateZ(15deg) scale(0);
      }
    
      42%,
      100% {
        transform: rotateY(-47deg) rotateX(-15deg) rotateZ(15deg) scale(1);
      }
    }
    
    @keyframes box-scale7 {
      34% {
        transform: rotateY(-47deg) rotateX(-15deg) rotateZ(15deg) scale(0);
      }
    
      42%,
      100% {
        transform: rotateY(-47deg) rotateX(-15deg) rotateZ(15deg) scale(1);
      }
    }
    
    @-webkit-keyframes ground {
    
      0%,
      65% {
        transform: rotateX(90deg) rotateY(0deg) translate(-48px, -120px) translateZ(100px) scale(0);
      }
    
      75%,
      90% {
        transform: rotateX(90deg) rotateY(0deg) translate(-48px, -120px) translateZ(100px) scale(1);
      }
    
      100% {
        transform: rotateX(90deg) rotateY(0deg) translate(-48px, -120px) translateZ(100px) scale(0);
      }
    }
    
    @keyframes ground {
    
      0%,
      65% {
        transform: rotateX(90deg) rotateY(0deg) translate(-48px, -120px) translateZ(100px) scale(0);
      }
    
      75%,
      90% {
        transform: rotateX(90deg) rotateY(0deg) translate(-48px, -120px) translateZ(100px) scale(1);
      }
    
      100% {
        transform: rotateX(90deg) rotateY(0deg) translate(-48px, -120px) translateZ(100px) scale(0);
      }
    }
    
    @-webkit-keyframes ground-shine {
    
      0%,
      70% {
        opacity: 0;
      }
    
      75%,
      87% {
        opacity: 0.2;
      }
    
      100% {
        opacity: 0;
      }
    }
    
    @keyframes ground-shine {
    
      0%,
      70% {
        opacity: 0;
      }
    
      75%,
      87% {
        opacity: 0.2;
      }
    
      100% {
        opacity: 0;
      }
    }
    
    @-webkit-keyframes mask {
    
      0%,
      65% {
        opacity: 0;
      }
    
      66%,
      100% {
        opacity: 1;
      }
    }
    
    @keyframes mask {
    
      0%,
      65% {
        opacity: 0;
      }
    
      66%,
      100% {
        opacity: 1;
      }
    }

    Whether you’re just starting with CSS animations or already creating advanced UI effects, this project is a great way to level up your 3D transform and animation skills while building something visually impressive. Let’s bring your loader to life! 🚀

    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!

    Animation loader Web Development
    Share. Copy Link Twitter Facebook LinkedIn Email WhatsApp
    Previous ArticleHow to Make Subway Super Hopper Game in HTML CSS & JavaScript
    Coding Stella
    • Website

    Related Posts

    HTML & CSS

    How to make Magic Social Share Menu using HTML CSS and JS

    5 February 2026
    HTML & CSS

    How to Make Social Media Icons Popups in HTML and CSS

    31 January 2026
    JavaScript

    How to create Glowing Tubes Cursor using HTML CSS and JS

    28 January 2026
    Add A Comment
    Leave A Reply Cancel Reply

    Trending Post

    Master Frontend in 100 Days Ebook

    2 March 202432K Views

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

    11 January 202431K Views

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

    14 February 202424K Views

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

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

    How to Get Source Code of Any Website ?

    25 January 2024

    How to make Team Profiles Rotation using HTML & CSS

    2 August 2024

    How to make Music Player with Slider | Swiper JS using HTML CSS & JavaScript

    21 May 2024

    How to make Panda Login Form using HTML CSS & JavaScript

    12 January 2024
    Latest Post

    How to make 3D Animated Box Loader using HTML and CSS

    20 February 2026

    How to Make Subway Super Hopper Game in HTML CSS & JavaScript

    15 February 2026

    How to make Magic Social Share Menu using HTML CSS and JS

    5 February 2026

    How to Make Memory Unmasked Game in HTML CSS & JavaScript

    4 February 2026
    Facebook X (Twitter) Instagram YouTube
    • About Us
    • Privacy Policy
    • Return and Refund Policy
    • Terms and Conditions
    • Contact Us
    • Buy me a coffee
    © 2026 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