Here in this tutorial you will learn how to create a awesome loading screen animation using Html and CSS.
Steps to be followed:-
- Create a div with a class and name the class what you like i am giving it name as center
- Now create 8 div tag inside the above div tag with class bar and bar1, bar2, bar3 utpo bar8 or even more if you like
- Now it's time for css... Reset the css body by margin 0
- Now align div in middle of the display
- Now provide the dimensions and background to the bars
- Provide the keyframes for animation
- Set the time delay to every bar to make it look like loading screen.
Html Code:-
<div class="center">
<div class="bar bar1"></div>
<div class="bar bar2"></div>
<div class="bar bar3"></div>
<div class="bar bar4"></div>
<div class="bar bar5"></div>
<div class="bar bar6"></div>
<div class="bar bar7"></div>
<div class="bar bar8"></div>
</div>
CSS Code:-
body{
margin: 0;
padding: 0;
background-color: #00456e;
}
.center{
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
.bar{
width: 6px;
height: 60px;
background: #fff;
display: inline-block;
animation: loading 1.2s ease-in infinite;
transform-origin: bottom center;
}
.bar1{
animation-delay: 0.1s;
}
.bar2{
animation-delay: 0.2s;
}
.bar3{
animation-delay: 0.3s;
}
.bar4{
animation-delay: 0.4s;
}
.bar5{
animation-delay: 0.5s;
}
.bar6{
animation-delay: 0.6s;
}
.bar7{
animation-delay: 0.7s;
}
.bar8{
animation-delay: 0.8s;
}
@keyframes loading{
0%{
transform: scaleY(0.1);
background: #ccc;
}
50%{
transform: scaleY(1);
background: #fff;
}
100%{
transform: scaleY(0.1);
background: #ccc;
}
}
Video Tutorial
If you like our tutorial please don't forgot to subscribe to our channel.