CSS3 animation using keyframes to transform - HTML CSS CSS Property

HTML CSS examples for CSS Property:transform

Description

CSS3 animation using keyframes to transform

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">

.a {<!-- ww  w  .  ja  v a 2s  .co  m-->
   display:inline-block;
   background:yellow;
   padding:50px;
}
.b {
   display:block;
   background:blue;
   width:100px;
   height:100px;
   -webkit-transform:rotateX(0deg);
   transform:rotateX(0deg);
   opacity:0.8;
   color:white;
   font-size:20px;
   text-align:center;
   -webkit-animation: spinz 3s reverse;
   animation: spinz 3s reverse;
}
.b:hover {
   z-index:900;
   -webkit-transform:rotateX(-180deg);
   transform:rotateX(-180deg);
   -webkit-animation: spinz 3s normal;
   animation: spinz 3s normal;
}
@-webkit-keyframes spinz {
   0% {
      -webkit-transform:rotateX(0deg);
   }
   25% {
      -webkit-transform:rotateX(-50deg);
   }
   50% {
      -webkit-transform:rotateX(0deg);
   }
   100% {
      -webkit-transform:rotateX(-180deg);
   }
}
@keyframes spinz {
   0% {
      transform:rotateX(0deg);
   }
   25% {
      transform:rotateX(-50deg);
   }
   50% {
      transform:rotateX(0deg);
   }
   100% {
      transform:rotateX(-180deg);
   }
}


      </style> 
 </head> 
 <body> 
  <div class="a"> 
   <div class="b">
     frontside 
   </div> 
  </div>  
 </body>
</html>

Related Tutorials