CSS Animations to change a property with a transition - HTML CSS CSS Animatable Property

HTML CSS examples for CSS Animatable Property:left

Description

CSS Animations to change a property with a transition

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

#wrap {<!--   w  w  w.j  a  v a2  s.  c  o m-->
   position: relative;
}
.hiding, .showing {
   width: 100px;
   left: 0;
   top: 0;
   position: absolute;
   color: white;
}
.showing {
   background: green;
   cursor: pointer;
}
.hiding {
   -webkit-animation: slide-one-pager 2s;
   -webkit-animation-fill-mode: forwards;
   background: red;
   z-index: 2;
}
@-webkit-keyframes slide-one-pager {
   0%   { left: 0; }
   49%  { left: 0; }
   50%  { left: -100px; }
   100% { left: -100px; }
}


      </style> 
 </head> 
 <body> 
  <div id="wrap"> 
   <div class="hiding">
     bye! 
   </div> 
   <div class="showing">
     hi! 
   </div> 
  </div>  
 </body>
</html>

Related Tutorials