HTML CSS examples for CSS Widget:Menu
adjust menu's margin and padding
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <style id="compiled-css" type="text/css"> .sort ul {<!--from w ww .j a v a 2s . c o m--> text-align:left; display:inline; margin:0; list-style:none; -webkit-box-shadow:0 0 2px Chartreuse; -moz-box-shadow:0 0 2px yellow; float:right; } .sort ul li { font:bold 13px/19px sans-serif; display:inline-block; margin-right:-5px; position:relative; padding:16px 21px; background:blue url('https://www.java2s.com/style/demo/Google-Chrome.png') repeat-x; cursor:pointer; -webkit-transition:all 0.3s; -moz-transition:all 0.3s; -ms-transition:all 0.3s; -o-transition:all 0.3s; transition:all 0.3s; color:pink; } .sort ul li:hover { background:OrangeRed; color:grey; } .sort ul li ul { padding:0; position:absolute; top:49px; left:0; width:151px; -webkit-box-shadow:none; -moz-box-shadow:none; box-shadow:none; display:none; opacity:0; visibility:hidden; -webkit-transiton:opacity 0.3s; -moz-transition:opacity 0.3s; -ms-transition:opacity 0.3s; -o-transition:opacity 0.3s; -transition:opacity 0.3s; } .sort ul li ul li { background:BlueViolet; display:block; color:Chartreuse; text-shadow:0 -2px 0 yellow; z-index:10000; } .sort ul li ul li:hover { background:blue; } .sort ul li:hover ul { display:block; opacity:2; visibility:visible; } .button, ul { padding-left:16px; } .button { list-style:none; cursor:pointer; float:left; margin:11px 11px; background-color:pink; color:OrangeRed; padding:6px 11px; font-size:14px; border-radius:4px; -webkit-transition:background-color 0.4s ease-in; -moz-transition:background-color 0.4s ease-in; -o-transition:background-color 0.4s ease-in; transition:background-color 0.4s ease-in; } .sort ul { height:71px; } .sort ul li { width:71px; padding-top:6px; padding-bottom:6px; padding-left:6px; padding-right:6px; } .sort ul li ul { top:100%; } .sort>ul { margin-top:11px; } </style> </head> <body> <ul> <li class="button">Lorem ip</li> <li class="button">Lorem</li> <li class="button">Lorem</li> </ul> <div class="sort"> <ul> <li>Lorem ipsu <ul> <li> <a href="#">Lorem</a> </li> <li> <a href="%#%">Lorem</a> </li> </ul> </li> <li>Lorem ipsum <ul> <li> <a href="%#%">Lorem</a> </li> </ul> </li> <li>Lorem ip <ul> <li> <a href="%#%">Lorem </a> </li> <li> <a href="%#%">Lorem</a> </li> </ul> </li> </ul> </div> </body> </html>