Create heart beat animation with box shadow - HTML CSS CSS Animatable Property

HTML CSS examples for CSS Animatable Property:box-shadow

Description

Create heart beat animation with box shadow

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <meta name="viewport" content="width=device-width, initial-scale=1"> 
  <style id="compiled-css" type="text/css">

.pulse {<!-- w w  w.j av  a  2s.  c o m-->
   margin: 100px;
   display: block;
   width: 85px;
   height: 85px;
   border-radius: 50%;
   background: #cca92c;
   cursor: pointer;
   box-shadow: 0 0 0 rgba(204, 169, 44, 0.4);
   animation: pulse 1s infinite;
   position: relative;
}
.pulse::before {
   content: '';
   box-shadow: 0 0 0 rgba(204, 169, 44, 0.4);
   animation: pulse2 1s infinite;
   animation-delay: 0.5s;
   border-radius: 50%;
   width: 85px;
   height: 85px;
   border-radius: 50%;
   display: block;
   position: absolute;
   left: 0;
   right: 0;
   top: 0;
   bottom: 0;
   margin: auto;
}
.pulse:hover {
   animation: none;
}
@-webkit-keyframes pulse {
   0% {
      -webkit-box-shadow: 0 0 0 0 rgba(204, 169, 44, 0.4);
   }
   70% {
      -webkit-box-shadow: 0 0 0 10px rgba(204, 169, 44, 0);
   }
   100% {
      -webkit-box-shadow: 0 0 0 0 rgba(204, 169, 44, 0);
   }
}
@keyframes pulse {
   0% {
      -moz-box-shadow: 0 0 0 0 rgba(204, 169, 44, 0.4);
      box-shadow: 0 0 0 0 rgba(204, 169, 44, 0.4);
   }
   70% {
      -moz-box-shadow: 0 0 0 10px rgba(204, 169, 44, 0);
      box-shadow: 0 0 0 40px rgba(204, 169, 44, 0);
   }
   100% {
      -moz-box-shadow: 0 0 0 0 rgba(204, 169, 44, 0);
      box-shadow: 0 0 0 0 rgba(204, 169, 44, 0);
   }
}
@-webkit-keyframes pulse2 {
   0% {
      -webkit-box-shadow: 0 0 0 0 rgba(204, 169, 44, 0.4);
   }
   70% {
      -webkit-box-shadow: 0 0 0 10px rgba(204, 169, 44, 0);
   }
   100% {
      -webkit-box-shadow: 0 0 0 0 rgba(204, 169, 44, 0);
   }
}
@keyframes pulse2 {
   0% {
      -moz-box-shadow: 0 0 0 0 rgba(204, 169, 44, 0.4);
      box-shadow: 0 0 0 0 rgba(204, 169, 44, 0.4);
   }
   70% {
      -moz-box-shadow: 0 0 0 10px rgba(204, 169, 44, 0);
      box-shadow: 0 0 0 60px rgba(204, 169, 44, 0);
   }
   100% {
      -moz-box-shadow: 0 0 0 0 rgba(204, 169, 44, 0);
      box-shadow: 0 0 0 0 rgba(204, 169, 44, 0);
   }
}


      </style> 
 </head> 
 <body> 
  <div class="nb-infosys-sun"> 
   <span class="pulse"></span> 
  </div>  
 </body>
</html>

Related Tutorials