Loading Animation Using HTML & CSS

Hello wizards, I hope you are doing great. Today in this blog you’ll learn how to create the "Loading Animation" project using HTML & CSS.

Preview 

In the above video, you’ve seen the preview of the "Loading Animation" project and I hope you are now able to create this type of project. If not, I have provided all the HTML & CSS code below. 

Loading Animation [Source Code] 

To get the following HTML & CSS code for the Loading Animation project. You need to create two files one is an HTML file, and the second one is a CSS file. After completing these two files, you can copy-paste the codes on your document. 

Remember, you’ve to create a file with a .html extension for HTML code and a .css extension for CSS code.

You can also download all source code files from the given download button.

HTML
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Loading Animation</title>
    <link rel="stylesheet" href="style.css">
</head>

<body>
    <h1>Loading Animation</h1>
    <div class="container">
        <span style="--i:1;"></span>
        <span style="--i:2;"></span>
        <span style="--i:3;"></span>
        <span style="--i:4;"></span>
        <span style="--i:5;"></span>
        <span style="--i:6;"></span>
        <span style="--i:7;"></span>
        <span style="--i:8;"></span>
        <span style="--i:9;"></span>
        <span style="--i:10;"></span>
        <span style="--i:11;"></span>
        <span style="--i:12;"></span>
        <span style="--i:13;"></span>
        <span style="--i:14;"></span>
        <span style="--i:15;"></span>
        <span style="--i:16;"></span>
        <span style="--i:17;"></span>
        <span style="--i:18;"></span>
        <span style="--i:19;"></span>
        <span style="--i:20;"></span>
    </div>
</body>

</html>
CSS
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: sans-serif;
}

body {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  min-height: 100vh;
  background-color: blueviolet;
}

h1 {
  margin-bottom: 70px;
  color: white;
}

.container {
  position: relative;
}

.container span {
  position: absolute;
  width: 20px;
  height: 10px;
  background-color: white;
  border-radius: 50%;
  transform: rotate(calc(var(--i) * (360deg / 20))) translate(50px);
  animation: rotationAnim 2s linear infinite;
  animation-delay: calc(var(--i) * 0.1s);
}

@keyframes rotationAnim {
  0% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}
You have to wait 15 seconds.

Generating Download Link...

Post a Comment

Previous Post Next Post