HTML CSS examples for CSS Widget:Menu Dropdown
Drop down menu with menu bar
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <style id="compiled-css" type="text/css"> nav {<!--from w w w.j a v a2 s. co m--> background-color: #004b98; width: 100%; margin: 0; padding: 0; } nav ul { margin: 0 auto; padding: 0; width: 900px; position: relative; } ul li { background-color: #004b98; float: left; list-style-type: none; border: 1px solid white; border-radius: 5px; margin: 5px; padding: 0; } nav ul li a { color: #ffffff; display: block; font-family: sans-serif; text-decoration: none; padding: 5px; } nav ul li:hover { background-color: #0069d4; } nav ul li { float: left; min-height: 1px; vertical-align: middle; } nav ul ul { display: none; position: absolute; top: 100%; left: 0; width: 100%; } nav ul li:hover > ul { display: block; } nav ul li:hover { position: relative; cursor: default; color: black; } ul ul {bottom: 0; left: 0; margin-top: 0;} .cf:before, .cf:after { content: " "; /* 1 */ display: table; /* 2 */ } .cf:after { clear: both; } /** * For IE 6/7 only * Include this rule to trigger hasLayout and contain floats. */ .cf { *zoom: 1; } </style> </head> <body> <nav class="cf"> <ul> <li> <a href="index.html">Home</a> <ul> <li> <a href="#">this is a test this is a test</a> </li> </ul> </li> <li> <a href="#">Gallery</a> </li> <li> <a href="#">Map</a> </li> </ul> </nav> </body> </html>