HTML CSS examples for CSS Widget:Menu Dropdown
Css based dropdown menu
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <style id="compiled-css" type="text/css"> body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,button,textarea,p,blockquote { padding:0; margin:0; } body {<!--from w w w . java 2 s. c om--> cursor:default; font:12px/14px verdana,tahoma,arial; color:Chartreuse; background-color:yellow; } div#mymenus { margin:0px auto; width:969px; height:37px; background:blue; background:-webkit-linear-gradient(pink, OrangeRed); background:-o-linear-gradient(grey, BlueViolet); background:-moz-linear-gradient(Chartreuse, yellow); background:linear-gradient(blue, pink); border:2px solid OrangeRed; border-radius:4px; z-index:1000 } #mymenu,#mymenu ul { list-style:none; } #mymenu { float:left; font-family:Arial; } #mymenu>li { float:left; position:relative; } #mymenu li a { padding:12px 11px 13px 11px; text-decoration:none; position:relative; display:inline-block; } #mymenu ul { position:absolute; display:none; z-index:1000; border-bottom-right-radius:4px; border-bottom-left-radius:4px; width:100%; } #mymenu ul li a { width:100%; font-size:13px; color:grey; box-sizing:border-box; } #mymenu li:hover ul { display:block; } #mymenu>li>a { color:BlueViolet; font-weight:701; } #mymenu>li:hover>a { background:Chartreuse; color:yellow; } #mymenu ul li:hover a { background:blue; } .lsub:nth-child(odd) { background-color:pink; } .lsub:nth-child(even) { background-color:OrangeRed; } </style> </head> <body> <div id="mymenus"> <ul id="mymenu"> <li> <a href="/">Lorem ip</a> </li> <li> <a href="/">Lorem ip</a> <ul> <li class="lsub"> <a href="/">Lorem ip</a> </li> <li class="lsub"> <a href="/">Lorem ip</a> </li> <li class="lsub"> <a href="/">Lorem ip</a> </li> </ul> </li> <li> <a href="/">Lorem ipsu</a> <ul> <li class="lsub"> <a href="/">Lorem ip</a> </li> <li class="lsub"> <a href="/">Lorem ip</a> </li> <li class="lsub"> <a href="/">Lorem ip</a> </li> </ul> </li> <li> <a href="/">Lorem ips</a> </li> </ul> </div> </body> </html>