JSFiddle - React, Tailwind, and code Playground
HTML
<div>content</div>
<div id="preloader">
<div id="uno"></div>
</div>
CSS
#preloader{
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
background: royalblue;
animation: hide 1s 4s forwards;
}
@keyframes hide {
0% {
opacity: 1;
visibility: visible;
}
90% {
opacity: 0;
visibility: visible;
}
100% {
opacity: 0;
visibility: hidden;
}
}
#uno{
position: absolute;
top: 50%;
left: 50%;
width: 20px;
height: 20px;
border-radius: 50%;
background: white;
animation: load .3s infinite;
}
@keyframes load {
0% {
transform: translate3d(0, 0, 0);
}
25% {
transform: translate3d(20px, 0, 0);
}
50% {
transform: translate3d(20px, 20px, 0);
}
75% {
transform: translate3d(0px, 20px, 0);
}
100% {
transform: translate3d(0px, 0px, 0);
}
}