Prism Loader with CSS

Today we will learn how to make loader with CSS

Add Below HTML Code

<div class="prism-loader">
  <div class="cube1"></div>
  <div class="cube2"></div>
</div>

Add Below CSS

.prism-loader {
  display: inline-block;
  position: relative;
  width: 40px;
  height: 40px;
}
.cube1, .cube2 {
  background-color: rgb(133, 108, 108);
  width: 15px;
  height: 15px;
  position: absolute;
  top: 0;
  left: 0;
  
  -webkit-animation: sk-cubemove 1.8s infinite ease-in-out;
  animation: sk-cubemove 1.8s infinite ease-in-out;
}
.cube2 {
  -webkit-animation-delay: -0.9s;
  animation-delay: -0.9s;
}

@-webkit-keyframes sk-cubemove {
  25% { -webkit-transform: translateX(40px) rotate(-90deg) scale(0.5) }
  50% { -webkit-transform: translateX(40px) translateY(40px) rotate(-180deg) }
  75% { -webkit-transform: translateY(40px) rotate(-270deg) scale(0.5) }
  100% { -webkit-transform: rotate(-360deg) }
}

@keyframes sk-cubemove {
  25% { 
    transform: translateX(40px) rotate(-90deg) scale(0.5);
    -webkit-transform: translateX(40px) rotate(-90deg) scale(0.5);
    background: #69b7eb;
  } 50% { 
    transform: translateX(40px) translateY(40px) rotate(-179deg);
    -webkit-transform: translateX(40px) translateY(40px) rotate(-179deg);
  } 50.1% { 
    transform: translateX(40px) translateY(40px) rotate(-180deg);
    -webkit-transform: translateX(40px) translateY(40px) rotate(-180deg);
    background: #b3dbd3;
  } 75% { 
    transform: translateY(40px) rotate(-270deg) scale(0.5);
    -webkit-transform: translateY(40px) rotate(-270deg) scale(0.5);
    background: #0e181f;
  } 100% { 
    transform: rotate(-360deg);
    -webkit-transform: rotate(-360deg);
    background: #f4d6db;
  }
  
}   
@keyframes change-background {
  0% {
    background: #69b7eb;
  }
  50% {
    background: #b3dbd3;
  }
  100% {
    background: #f4d6db;
  }
}

Demo:

Submit a Comment

Your email address will not be published. Required fields are marked *

Subscribe

Select Categories