HTML CSS examples for CSS Widget:Menu sub menu
Pure HTML/CSS menu with horizontal submenu
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <style id="compiled-css" type="text/css"> .wrapper {<!--from w w w .jav a 2 s . c om--> width:901px; height:201px; background:grey; } .menu-holder { padding:51px 0 0 0; } .menu-holder ul { margin:0 0 0px 26px; padding:0; list-style-type:none; } .menu-holder ul li { position:relative; float:left; border-left:2px dotted Chartreuse; line-height:0px; margin:0; } .menu-holder ul li:last-child { border-right:2px dotted yellow; } .menu-holder ul li a { font-family:arial, sans-serif; font-size:13px; font-style:bold; display:block; color:blue; text-decoration:none; padding:16px 11px 16px 11px; } .menu-holder ul li:hover { display:block; background-color:pink; border-radius:6px 6px 0 0; } .menu-holder ul li a:hover + ul { display:block; } .menu-holder ul li ul { display:none; position:absolute; top:100%; left:0px; right:auto; margin:0; padding:0; white-space:nowrap; } .menu-holder ul li ul li { position:static; float:left; display:inline; border:0; padding:16px 11px 16px 11px; background-color:OrangeRed; } .menu-holder ul li ul li:last-child { border-right:0px; } .menu-holder ul li ul li a { display:inline; margin:0 0px 0 0px; padding:0px 11px 0px 11px; } .menu-holder ul li ul li:first-of-type { -webkit-border-radius:0px 6px 0px 0px; border-radius:0px 6px 0px 0px; } .menu-holder ul li ul li:last-of-type { -webkit-border-radius:0px 0px 6px 6px; border-radius:0px 0px 6px 6px; } .menu-holder ul li ul:hover { display:block; } .menu-holder ul li ul:hover .test { display:block; background-color:grey; } .menu-wrapper .menu-holder ul li:first-of-type { border-left:none; } </style> </head> <body> <div class="wrapper"> <div class="menu-holder"> <ul class="menu"> <li> <a href="#" title="Home">Lorem </a> </li> <li> <a class="test" href="#">Lorem ipsum dol</a> <ul> <li> <a href="#">Lorem ipsum do</a> </li> <li> <a href="#">Lorem ipsum do</a> </li> </ul> </li> <li> <a href="#">Lorem ipsum</a> <ul> <li> <a href="#">Lorem ipsum do</a> </li> <li> <a href="#">Lorem ipsum do</a> </li> </ul> </li> <li> <a href="#">Lorem ips</a> </li> </ul> </div> </div> </body> </html>