HTML CSS examples for CSS Widget:Menu Dropdown
prevent overlapping dropdown menu with borders
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <style id="compiled-css" type="text/css"> #nav {<!-- w w w . ja va2 s . co m--> background-color:Chartreuse; } #wrap { display:table; height:100px; margin:0 auto; } #nav ul { padding:0; margin:0; display:table-cell; vertical-align:bottom; } #nav ul li { display:inline-block; } #nav ul li a { display:block; padding:16px; text-decoration:none; color:yellow; } #nav ul li:after { content:""; display:block; height:6px; } #nav ul ul { display:none; position:absolute; background-color:blue; margin-top:6px; } #nav ul ul li { display:block; min-width:201px; } #nav ul li:hover { background-color:pink; } #nav ul li:hover:after { background:OrangeRed; } #nav ul li:hover ul { display:block; } #nav ul ul li:after { height:0; } </style> </head> <body> <div id="nav"> <div id="wrap"> <ul> <li> <a href="#">Lore</a> </li> <li> <a href="#">Lorem</a> </li> <li> <a href="#">Lorem</a> <ul> <li> <a href="#">Lorem i</a> </li> <li> <a href="#">Lorem ipsum do</a> </li> <li> <a href="#">Lorem ipsum dolo</a> </li> <li> <a href="#">Lorem ipsum dol</a> </li> </ul> </li> <li> <a href="#">Lore</a> </li> <li> <a href="#">Lorem i</a> </li> <li> <a href="#">Lorem ip</a> </li> </ul> </div> </div> </body> </html>