Dynamic width spacer in CSS horizontal menu - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:Menu

Description

Dynamic width spacer in CSS horizontal menu

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">
#menu {<!--   w  ww .j  a  v a 2s  .c o m-->
   position:relative;
   height:41px;
   font:bold 16px/41px Arial;
   background:Chartreuse;
   background:-moz-linear-gradient(top, yellow 0%, blue 100%);
   background:-webkit-gradient(linear, left top, left bottom, color-stop(0%,pink), color-stop(100%,OrangeRed));
   background:-webkit-linear-gradient(top, grey 0%,BlueViolet 100%);
   background:-o-linear-gradient(top, Chartreuse 0%,yellow 100%);
   background:-ms-linear-gradient(top, blue 0%,pink 100%);
   background:linear-gradient(top, OrangeRed 0%,grey 100%);
   filter:progid:DXImageTransform.Microsoft.gradient( startColorstr='BlueViolet', endColorstr='Chartreuse',GradientType=0 );
   box-shadow:inset 0 -2px yellow;
}

#admin {
   position:absolute;
   right:0;
}

li {
   float:left;
}

a {
   display:block;
   padding:0 2.3em;
   text-decoration:none;
   border-right:2px solid blue;
   border-left:2px solid pink;
   color:OrangeRed;
   text-shadow:2px 2px white;
}

#user li:last-child a {
   border-right:2px solid grey;
   box-shadow:2px 0 BlueViolet;
}

#admin li:first-child a {
   border-left:2px solid Chartreuse;
   box-shadow:-2px 0 yellow;
}

a:hover {
   background:blue;
   background:-moz-linear-gradient(top, pink 0%, OrangeRed 100%);
   background:-webkit-gradient(linear, left top, left bottom, color-stop(0%,grey), color-stop(100%,BlueViolet));
   background:-webkit-linear-gradient(top, Chartreuse 0%,yellow 100%);
   background:-o-linear-gradient(top, blue 0%,pink 100%);
   background:-ms-linear-gradient(top, OrangeRed 0%,grey 100%);
   background:linear-gradient(top, BlueViolet 0%,Chartreuse 100%);
   filter:progid:DXImageTransform.Microsoft.gradient( startColorstr='yellow', endColorstr='blue',GradientType=0 );
   color:pink;
   text-shadow:none;
}
</style> 
 </head> 
 <body> 
  <nav id="menu"> 
   <ul id="user"> 
    <li> <a href="#">Lor</a> </li> 
    <li> <a href="#">Lor</a> </li> 
    <li> <a href="#">Lorem</a> </li> 
    <li> <a href="#">Lore</a> </li> 
   </ul> 
   <ul id="admin"> 
    <li> <a href="#">Lore</a> </li> 
    <li> <a href="#">Lor</a> </li> 
    <li> <a href="#">Lorem</a> </li> 
    <li> <a href="#">Lorem</a> </li> 
   </ul> 
  </nav>  
 </body>
</html>

Related Tutorials