Slide background up - HTML CSS CSS Property

HTML CSS examples for CSS Property:background

Description

Slide background up

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

#container{<!-- www .  j a va  2  s . c o  m-->
   position:relative;
   width:100px;
   height:100px;
   border-style:inset;}
   #content{
      opacity: 0;
      -webkit-animation:animDown 1s ease;
      position:absolute;
      top:100px;
      width:100%;
      height:100%;
      background-color:lightgreen;
   }
   #container:not(:hover) #content {
      visibility: hidden;
      transition: visibility 0.01s 1s;
   }
   #container:hover #content{
      -webkit-animation:animUp 1s ease;
      -webkit-animation-fill-mode:forwards;
      animation-fill-mode:forwards;
   }
   @-webkit-keyframes animUp{
      0% {
         -webkit-transform:translateY(0);
         transform:translateY(0);
         opacity:0;}
         100% {
            -webkit-transform:translateY(-100%);
            transform:translateY(-100%);
            visibility:visible;
            opacity:1;}
         }
         @-webkit-keyframes animDown{
            0% {
               -webkit-transform:translateY(-100%);
               transform:translateY(-100%);
               opacity:1;}
               100% {
                  -webkit-transform:translateY(0);
                  transform:translateY(0);
                  opacity:0;}
               }


      </style> 
 </head> 
 <body> 
  <div id="container"> 
   <div id="content"></div> 
  </div>  
 </body>
</html>

Related Tutorials