Pure CSS menu - submenu - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:Menu sub menu

Description

Pure CSS menu - submenu

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">
#nav, #nav a {<!--from   w ww.  j  a va  2s .  co m-->
   text-decoration:none;
   text-transform:uppercase;
   color:Chartreuse;
   padding:0px 2px 0px 2px;
   margin:0px;
   border:solid yellow;
   text-decoration:none;
   font-weight:bold;
   font-style:italic;
   font-size:116%;
   list-style-type:none;
   font-family:sans-serif;
   margin-left:none;
   background-color:blue;
   z-index:100;
}

#nav>li {
   float:left;
}

#nav li ul {
   list-style-type:none;
   display:none;
   width:21em;
   position:absolute;
   left:5px;
   font-weight:normal;
}

#nav li>ul {
   top:auto;
   left:auto;
}

#nav li:hover>ul {
   display:block;
}

#nav li a:hover {
   background-color:pink;
}

#nav li a:link, #nav li a:visited {
   padding:0em .26em 0em 0.26em;
   border:solid OrangeRed;
   text-decoration:none;
   display:block;
   left:3px;
}

#nav li>a {
   font-weight:normal;
}

#nav li #subnav>ul {
   padding-left:0px;
   left:151px;
}

#subnav li a:link, #subnav li a:visited {
   color:grey;
   padding:0em .26em 0em 0.26em;
   border:solid BlueViolet;
   display:block;
   left:3px;
   background-color:Chartreuse;
}

#subnav li a:hover {
   background-color:yellow;
   position:relative;
   left:2px;
}
</style> 
 </head> 
 <body> 
  <ul id="nav"> 
   <li> 
    <div> 
     <a href="#">Lorem ipsu</a> 
    </div> 
    <ul> 
     <li> <a href="#">Lorem ipsum </a> </li> 
     <li> <a href="#">Lorem ipsum d</a> </li> 
     <li id="subnav"> <a href="#">Lorem ipsum </a> 
      <ul> 
       <li> <a href="#">Lorem ipsum dolo</a> </li> 
       <li> <a href="#">Lorem ipsum dolor</a> </li> 
       <li> <a href="#">Lorem ipsum dolo</a> </li> 
       <li> <a href="#">Lorem ipsum dolor</a> </li> 
      </ul> </li> 
     <li> <a href="#">Lorem ipsum </a> </li> 
     <li id="subnav"> <a href="#">Lorem ipsum dolor s</a> 
      <ul> 
       <li> <a href="#">Lorem ipsum dolor sit amet, conse</a> </li> 
       <li> <a href="#">Lorem ipsum dolor sit amet, consec</a> </li> 
      </ul> </li> 
     <li> <a href="#">Lorem ipsum d</a> </li> 
    </ul> </li> 
   <li> 
    <div> 
     <a href="#">Lorem ipsum</a> 
    </div> 
    <ul> 
     <li> <a href="#">Lorem ipsum dolor</a> </li> 
     <li> <a href="#">Lorem ipsum dolor </a> </li> 
    </ul> </li> 
  </ul>  
 </body>
</html>

Related Tutorials