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 create Awesome Cool Loading Animation using HTML CSS and JS
    HTML & CSS

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

    Coding StellaBy Coding Stella16 June 2025No Comments3 Mins Read
    Share Facebook Twitter Pinterest LinkedIn Tumblr Reddit Email WhatsApp Copy Link

    Let’s create an Awesome Cool Loading Animation using HTML and CSS! ⏳✨ This project will feature a smooth and eye-catching loading effect that makes your website look modern and professional while content is being loaded.

    We’ll use:

    • HTML to set up the basic loader structure.
    • CSS to bring it to life with animations, colors, and transitions.

    Whether you’re building a portfolio, app, or landing page, this loading animation is a great way to keep users engaged. It’s simple to build and fun to watch – so let’s get coding and make loading screens look cool!

    HTML :

    This HTML code creates an animated “acrobatic” loading effect using SVG (Scalable Vector Graphics). It includes two gradient-colored strokes—one circular and one worm-like path—inside an SVG element styled via an external CSS file. The animation is visually enhanced using linearGradient, stroke-dasharray, and colored paths to make it look dynamic and smooth, likely animated in the style.css.

    <!DOCTYPE html>
    <html lang="en">
    
    <head>
        <meta charset="UTF-8">
        <title>Acrobatic Loading Animation | @coding.stella</title>
        <link rel="stylesheet" href="./style.css">
    </head>
    
    <body>
    
        <main>
            <svg class="ap" viewBox="0 0 128 256" width="128px" height="256px" xmlns="http://www.w3.org/2000/svg">
    		<defs>
    			<linearGradient id="ap-grad1" x1="0" y1="0" x2="0" y2="1">
    				<stop offset="0%" stop-color="hsl(223,90%,55%)" />
    				<stop offset="100%" stop-color="hsl(253,90%,55%)" />
    			</linearGradient>
    			<linearGradient id="ap-grad2" x1="0" y1="0" x2="0" y2="1">
    				<stop offset="0%" stop-color="hsl(193,90%,55%)" />
    				<stop offset="50%" stop-color="hsl(223,90%,55%)" />
    				<stop offset="100%" stop-color="hsl(253,90%,55%)" />
    			</linearGradient>
    		</defs>
    		<circle class="ap__ring" r="56" cx="64" cy="192" fill="none" stroke="#ddd" stroke-width="16" stroke-linecap="round" />
    		<circle class="ap__worm1" r="56" cx="64" cy="192" fill="none" stroke="url(#ap-grad1)" stroke-width="16" stroke-linecap="round" stroke-dasharray="87.96 263.89" />
    		<path class="ap__worm2" d="M120,192A56,56,0,0,1,8,192C8,161.07,16,8,64,8S120,161.07,120,192Z" fill="none" stroke="url(#ap-grad2)" stroke-width="16" stroke-linecap="round" stroke-dasharray="87.96 494" />
    	</svg>
        </main>
    
    </body>
    
    </html>

    CSS :

    This CSS styles and animates an SVG-based acrobatic loading animation. It uses responsive design with fluid font sizing, light/dark theme support, and sets a centered layout. Two SVG paths (worm1 and worm2) animate in a loop using keyframes to simulate movement, with stroke-dashoffset creating a spinning/stretching effect. The background and stroke colors adapt to system theme, and the animation switches visibility between the two worms to create a seamless, dynamic loading illusion.

    * {
      border: 0;
      box-sizing: border-box;
      margin: 0;
      padding: 0;
    }
    
    :root {
      --hue: 223;
      --bg: hsl(var(--hue), 10%, 90%);
      --fg: hsl(var(--hue), 10%, 10%);
      font-size: calc(16px + (24 - 16) * (100vw - 320px) / (1280 - 320));
    }
    
    body {
      background-color: var(--bg);
      color: var(--fg);
      font: 1em/1.5 sans-serif;
      height: 100vh;
      display: grid;
      place-items: center;
      transition: background-color 0.3s;
    }
    
    main {
      padding: 1.5em 0;
    }
    
    .ap {
      width: 8em;
      height: 16em;
    }
    .ap__ring {
      stroke: hsla(var(--hue), 10%, 10%, 0.15);
      transition: stroke 0.3s;
    }
    .ap__worm1,
    .ap__worm2 {
      animation-duration: 3s;
      animation-iteration-count: infinite;
    }
    .ap__worm1 {
      animation-name: worm1;
    }
    .ap__worm2 {
      animation-name: worm2;
      visibility: hidden;
    }
    
    /* Dark theme */
    @media (prefers-color-scheme: dark) {
      :root {
        --bg: hsl(var(--hue), 10%, 10%);
        --fg: hsl(var(--hue), 10%, 90%);
      }
      .ap__ring {
        stroke: hsla(var(--hue), 10%, 90%, 0.1);
      }
    }
    
    /* Animtions */
    @keyframes worm1 {
      from {
        animation-timing-function: ease-in-out;
        stroke-dashoffset: -87.96;
      }
      20% {
        animation-timing-function: ease-in;
        stroke-dashoffset: 0;
      }
      60% {
        stroke-dashoffset: -791.68;
        visibility: visible;
      }
      60.1%,
      to {
        stroke-dashoffset: -791.68;
        visibility: hidden;
      }
    }
    @keyframes worm2 {
      from,
      60% {
        stroke-dashoffset: -87.96;
        visibility: hidden;
      }
      60.1% {
        animation-timing-function: cubic-bezier(0, 0, 0.5, 0.75);
        stroke-dashoffset: -87.96;
        visibility: visible;
      }
      77% {
        animation-timing-function: cubic-bezier(0.5, 0.25, 0.5, 0.88);
        stroke-dashoffset: -340;
        visibility: visible;
      }
      to {
        stroke-dashoffset: -669.92;
        visibility: visible;
      }
    }

    In short, making an Awesome Cool Loading Animation with HTML and CSS adds a stylish touch to your projects. It’s a simple trick that improves user experience and shows attention to design details. 🚀

    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 JavaScript loader
    Share. Copy Link Twitter Facebook LinkedIn Email WhatsApp
    Previous ArticleHow to create Login and Signup Form using HTML CSS and JS
    Coding Stella
    • Website

    Related Posts

    JavaScript

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

    9 June 2025
    JavaScript

    How to create Impossible light bulb using HTML CSS and JS

    5 June 2025
    JavaScript

    How to create Animated Rubik Cube using HTML CSS and JS

    3 June 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 Make Form Validation in HTML CSS and JavaScript

    11 December 2023

    How to make Glassmorphism Login Form with Various Theme in HTML CSS & JavaScript

    12 January 2024

    How to make Card Mouse Hover Effect using HTML CSS & JavaScript

    14 October 2024

    How to make Pepsi Product Card using HTML & CSS

    17 September 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