HTML CSS examples for CSS Widget:Menu
Display div inline wrapping a list <ul> menu
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <style id="compiled-css" type="text/css"> #cont<!--from w w w . j a v a 2 s . c om--> { border:5px solid Chartreuse; overflow:hidden; width:auto; display:inline; } #nav { position:relative; padding:0; margin:0; display:inline-block; } #nav li { margin-right:2em; float:left; } #nav, #nav ul { list-style:none; } #nav ul { background-color:yellow; position:absolute; left:-1000em; } #nav ul li { float:none; } #nav li:hover ul { left:auto; margin:0; padding-top:0.6em; padding-left:0; } #nav li:hover>a { color:blue; background-color:pink; } #nav li ul li:hover { color:OrangeRed; background-color:grey; } </style> </head> <body> <div id="cont"> <ul id="nav"> <li> <a href="#">Lorem</a> <ul> <li>Lorem </li> <li>Lorem i</li> <li>Lorem </li> <li>Lorem i</li> </ul> </li> <li> <a href="#">Lorem</a> <ul> <li>Lorem i</li> <li>Lorem ip</li> <li>Lorem i</li> <li>Lorem ip</li> </ul> </li> </ul> </div> </body> </html>