html - Create drop down menu without ul inside li -
i want create drop down menu faced problem:
actually want create without making <ul>
tag inside <li>
tag code :
<!doctype html> <html> <head> <meta charset=utf-8 /> <title>js bin</title> </head> <body> <ul> <li><a>coffee</a></li> <ul><li><a>coffee 2</a></li></ul> <li><a>tea</a></li> <li><a>milk</a></li> </ul> </body> </html>
and css code :
ul { font-family: arial, verdana; font-size: 14px; margin: 0; padding: 0; list-style: none; z-index: 1; } ul li { display: block; position: relative; float: left; } li ul { display: none; } ul li { display: block; text-decoration: none; color: #ffffff; border-top: 1px solid #ffffff; padding: 5px 15px 5px 15px; background: #1e7c9a; margin-left: 1px; white-space: nowrap; } ul li a:hover { background: #3b3b3b; } li:hover ul { display: block; position: absolute; } li:hover li { float: none; font-size: 11px; } li:hover { background: #3b3b3b; } li:hover li a:hover { background: #1e7c9a; }
you can see coffee 2
not dropdown should coffe menu please me without making <ul>
tag inside <li>
.
jsbin link : http://jsbin.com/evasof/1/edit
here go:
<ul> <li class="dpdwn"><a>coffee</a><div><a>coffe 2</a></div></li> <li><a>tea</a></li> <li><a>milk</a></li> </ul>
extra css:
.dpdwn div{ display: none; } .dpdwn:hover div { display:block; }
but in opinion should use ul
inside li
. here's example:
<ul> <li class="dpdwn"><a>coffee</a> <ul> <li><a>coffe 2</a></li> </ul> </li> <li><a>tea</a></li> <li><a>milk</a></li> </ul>
that same css:
.dpdwn ul{ display: none; } .dpdwn:hover ul { display:block; }
Comments
Post a Comment