Make element fly in with mouse hover with dynamic width - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:Hover

Description

Make element fly in with mouse hover with dynamic width

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 {<!--   w ww. j  a v a  2s .  c  o m-->
   width:201px;
   height:51px;
   border:2px solid Chartreuse;
   overflow:hidden;
   white-space:nowrap;
   text-align:left;
   direction:rtl;
}

span {
   height:51px;
   display:inline-block;
}

.child1 {
   background:aqua;
   width:51px;
   margin-right:-51px;
   float:right;
   transition:margin-right .3s;
}

.child2 {
   background:tomato;
}

.container:hover .child1 {
   margin-right:0;
}
</style> 
 </head> 
 <body> 
  <div class="container"> 
   <span class="child1">Fixed</span> 
   <span class="child2">Dynamic Width</span> 
  </div> 
  <div class="container"> 
   <span class="child1">Fixed</span> 
   <span class="child2">Here is a Dynamic Width box</span> 
  </div>  
 </body>
</html>

Related Tutorials