Change width on hover using css - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:Hover to change

Description

Change width on hover using 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">
html {<!--from   ww  w.  j av  a  2 s  .com-->
   background:Chartreuse;
}

ul {
   display:block;
   list-style-type:none;
   padding:6px;
   margin:0;
}

ul li {
   display:block;
   margin:0px 6px;
   margin-left:-14px;
   list-style:none;
}

ul li a {
   display:block;
   width:61px;
   background:yellow;
   height:26px;
   left:11px;
   position:relative;
   top:0px;
   transition:width 401ms, height 201ms, border-radius 201ms,left 201ms, top 201ms, background-color 401ms;
   -moz-transition:width 401ms, height 201ms, border-radius 201ms,left 201ms, top 201ms, background-color 401ms;
   -ms-transition:width 401ms, height 201ms, border-radius 201ms,left 201ms, top 201ms, background-color 401ms;
   -o-transition:width 401ms, height 201ms, border-radius 201ms,left 201ms, top 201ms, background-color 401ms;
   -webkit-transition:width 401ms, height 201ms, border-radius 201ms,left 201ms, top 201ms, background-color 401ms;
}

ul li a:hover {
   width:251px;
   height:26px;
   left:0px;
   top:0px;
   background-color:blue;
   z-index:1001;
   overflow:visible;
}
</style> 
 </head> 
 <body> 
  <ul> 
   <li> <a href="content1.html">Lorem ip</a> </li> 
   <li> <a href="content2.html">Lorem ip</a> </li> 
   <li> <a href="content3.html">Lorem ip</a> </li> 
   <li> <a href="content4.html">Lorem ip</a> </li> 
   <li> <a href="content5.html">Lorem ip</a> </li> 
   <li> <a href="content6.html">Lorem ip</a> </li> 
  </ul>  
 </body>
</html>

Related Tutorials