Circular Loader Spinner Using CSS
In this article, I'll show you how to use CSS to create a quick circular loader spinner using a few basic CSS properties.
This spinner can be used as a preloader for your webpage or as a loader for a circular image or video.
I'll show you how to create the spinner using just a few simple CSS properties, and then I'll show you how to style it to match your graphics perfectly. This is a great way to add an extra touch of polish to your web pages.
Watch Video Tutorial
https://youtu.be/s8A6qUuyfkE
Live Preview.!
HTML Code
<div class="loader">
<span></span>
<span></span>
<span></span>
</div>
CSS Code
:root{
--color1 : #D62828;
--color2: #F77F00;
--color3: #003049;
}
*{
padding: 0;
margin: 0;
box-sizing: border-box;
}
body{
width: 100%;
height: 100vh;
display: grid;
place-items: center;
}
.loader{
width: 80px;
height: 80px;
display: grid;
place-items: center;
position: relative;
visibility: hidden;
opacity: 0;
z-index: -100;
animation: animate 0.9s linear 0s infinite;
}
.loader span:nth-child(1){
width: 100%;
height: 100%;
border-radius: 50%;
position: absolute;
border-top: 12px solid var(--color1);
border-right: 10px solid transparent;
}
.loader span:nth-child(1):before{
content: '';
width: 11px;
height: 11px;
position: absolute;
top: -1px;
left: 85%;
border-radius: 50%;
background-color: var(--color1);
}
.loader span:nth-child(2){
width: 100%;
height: 100%;
border-radius: 50%;
position: absolute;
border-top: 12px solid var(--color2);
border-right: 10px solid transparent;
rotate: 175deg;
}
.loader span:nth-child(2):before{
content: '';
width: 11px;
height: 11px;
position: absolute;
top: -1px;
left: 85%;
border-radius: 50%;
background-color: var(--color2);
}
.loader span:nth-child(3){
width: 50%;
height: 50%;
border-radius: 50%;
position: absolute;
border-right: 6px solid transparent;
border-bottom: 7px solid var(--color3);
rotate: 90deg;
animation: animate 0.2s linear 0s infinite reverse;
}
.loader span:nth-child(3):before{
content: '';
width: 7px;
height: 7px;
position: absolute;
top: 86%;
left: 83%;
border-radius: 50%;
background-color: var(--color3);
}
@keyframes animate {
0%{
visibility: visible;
opacity: 1;
z-index: 1;
}
100%{
opacity: 1;
rotate: 360deg;
}
}
0 Comments