Transformations 3D in CSS3 to flip rectangle - HTML CSS CSS Animation

HTML CSS examples for CSS Animation:3D

Description

Transformations 3D in CSS3 to flip rectangle

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">
#scene3D {<!--from   w w w  .j a v  a  2s  . c o m-->
   width:301px;
   height:301px;
   margin:auto;
   -webkit-perspective:501px;
   perspective:501px;
}

#flip {
   width:301px;
   height:301px;
   -webkit-transform:rotateX(0deg);
   transform:rotateX(0deg);
   transition:all 2s ease;
}

#scene3D:hover #flip {
   -webkit-transform:rotateX(181deg);
   transform:rotateX(181deg);
}

#flip div {
   position:absolute;
   width:301px;
   height:301px;
   background:red;
   -webkit-backface-visibility:hidden;
   backface-visibility:hidden;
}

#flip:hover div {
   -webkit-backface-visibility:visible;
   backface-visibility:visible;
}

#flip div:last-child {
   background:green;
   -webkit-transform:rotateX(181deg);
   transform:rotateX(181deg);
}
</style> 
 </head> 
 <body> 
  <div id="scene3D"> 
   <div id="flip"> 
    <div>
      Lorem ipsu 
    </div> 
    <div>
      Lorem ipsum 
    </div> 
   </div> 
  </div>  
 </body>
</html>

Related Tutorials