Slide down menu bar using CSS3 and HTML5 -
i have html5 , css3 menu bar i've been working on , i'm trying make visible when hovering on div. on have done wrong appreciated.
here code, thankyou in advance:
html
<!doctype html> <html> <head> <title> navigation </title> <link rel="stylesheet" type="text/css" href="navigation.css"/> </head> <body> <nav> <ul> <li><a href="#">home</a></li> <li><a href="#">menu 1</a> <ul> <li><a href="#">submenu 1</a></li> <li><a href="#">submenu 2</a></li> <li><a href="#">submenu 3</a></li> </ul> </li> <li><a href="#">menu 2</a> <ul> <li><a href="#">submenu 4</a></li> <li><a href="#">submenu 5</a></li> </ul> </li> <li><a href="#">menu 3</a></li> </ul> </nav> <div id="hideshow"> <center> <p style="font-size: 25px"> . . . </p> </center> </div> </body> </html>
css
nav ul ul { display: none; } nav { display: none; } nav ul li:hover > ul { display: block; } nav ul { margin-right: 1em; display: inline-table; margin-left: 0; padding-left: 0; opacity: 0.6; margin: 0; width: 100%; background: #c6e2ff; box-shadow: 0px 0px 9px rgba(0,0,0,0.15); padding: 0 20px; border-radius: 10px; list-style: none; position: relative; } nav ul li { float: left; background-color: #ff5050; border-right: 20px solid #ff0000; border-left: 20px solid #ff0000; } nav ul li:hover { border-radius: 10px; background: #ffa000; border-right: 40px solid #ff0000; -webkit-transition: 1s ease; } nav ul li:hover { color: #fff; } nav ul li { display: block; padding: 25px 40px; color: #e0e0e0; text-decoration: none; } nav ul ul { border-radius: 0px; background: #c6e2ff; border-radius: 0px; padding: 0; position: absolute; top: 100%; } nav ul ul li { float: none; border-top: 3px solid #c6e2ff; border-bottom: 3px solid #c6e2ff; position: relative; } nav ul ul li { padding: 15px 40px; color: #fff; } nav ul ul li a:hover { background: #ff5050; border-left: 12px solid #ffa000; -webkit-transition: 1s; } nav ul li:hover > ul ul li { background: #ff5050; border-left: 12px solid #ffa000; -webkit-transition: 1s; } nav ul ul li:hover { background: #ff5050; border-left: 12px solid #ffa000; -webkit-transition: 1s; background-color: #ff5050; } nav ul:hover { opacity: 1; -webkit-transition: 1s; } #hideshow { border: 2px dashed #e0e0ee; box-shadow: 0px 0px 9px rgba(0,0,0,0.15); width: 100%; background-color: #e0e0e0; } #hideshow:hover nav ul { display: inline-table; border: 2px dashed #e0e0ee; box-shadow: 0px 0px 9px rgba(0,0,0,0.15); } #hideshow p { color: #9c9c78; }
you using "adjacent sibling combinator"
#hideshow:hover + nav { display: block; }
here jsfiddle: example
but way won't able use it. if want use have restructure markup. example putting nav element div element. here jsfiddle: another example
Comments
Post a Comment