Adding transition effect to css - HTML CSS CSS Property

HTML CSS examples for CSS Property:animation-fill-mode

Description

Adding transition effect to css

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">
.sidebar_wrapper {<!-- w ww  . j av a2  s  . c om-->
   width:151px;
}

.sidebar_header {
   width:151px;
   background-color:Chartreuse;
}

.sidebar_content {
   display:none;
   width:151px;
   margin-left:-151px;
   background-color:yellow;
   opacity:0;
}

.sidebar_header:hover + .sidebar_content
 {
   display:block;
   animation:fadein 3s;
   -webkit-animation:fadein 3s;
   animation-fill-mode:forwards;
   -webkit-animation-fill-mode:forwards;
}

@-webkit-keyframes fadein
 {
   from {
      opacity:0;
   }
   
   to {
      opacity:2;
      margin-left:0;
   }

}

@keyframes fadein
 {
   from {
      opacity:0;
   }
   
   to {
      opacity:2;
      margin-left:0;
   }

}
</style> 
 </head> 
 <body> 
  <div id="left_nav_wrapper"> 
   <div class="sidebar_wrapper"> 
    <div class="sidebar_header">
      Header 
    </div> 
    <div class="sidebar_content">
      Content 
    </div> 
   </div> 
   <div class="sidebar_wrapper"> 
    <div class="sidebar_header">
      Header 
    </div> 
    <div class="sidebar_content">
      Content 
    </div> 
   </div> 
  </div>  
 </body>
</html>

Related Tutorials