Hover to fly in text in a div - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Text

Description

Hover to fly in text in a div

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">
.square {<!--   w w  w .j ava  2  s .  c om-->
   display:inline-block;
   height:100px;
   width:100px;
   background:Chartreuse;
   overflow:hidden;
   border:2px solid yellow;
}

.shown {
   position:relative;
   display:block;
}

.hidden {
   position:relative;
   display:block;
   top:100px;
}

.square:hover .shown {
   transition:top 0.6s ease;
   top:-51px;
}

.square:hover .hidden {
   transition:top 0.6s ease;
   top:0px;
}
</style> 
 </head> 
 <body> 
  <div class="square"> 
   <div class="shown">
     test 
   </div> 
   <div class="hidden">
     test 
   </div> 
  </div> 
  <div class="square"> 
   <div class="shown">
     test 
   </div> 
   <div class="hidden">
     test 
   </div> 
  </div> 
  <br> 
  <div class="square"> 
   <div class="shown">
     asdf 
   </div> 
   <div class="hidden">
     test 
   </div> 
  </div>  
 </body>
</html>

Related Tutorials