html - Hover drop down menu with different properties from parent -
i trying create button when hovered on dispays 2 dropdown menus different properties using css. problem @ moment dropdown menus' properties not change when hovered on , seems if button expands instead of showing 2 different menus below it. (trying achieve similar demo shown here: http://www.tutorialrepublic.com/codelab.php?topic=faq&file=show-hide-dropdown-on-mouse-hover). here code:
#nav { margin: 0; text-align: left; color: #333; } #nav ul { padding-right: 3.5px; list-style-type: none; text-align: left; display: none; visibility: hidden; } #nav ul li{ margin-left: 0; padding-left: 0; color: black; line-height: 21px; position: relative; } #nav:hover .myclassul{ visibility: visible; display: block; } .myclassul { min-width: 50px; background: #f2f2f2; display: none; position: static; z-index: 999; left: 0; }
<button id="nav" class="selected arrow">communications▼ <ul class="myclassul"> <li id="emailbutton" class="pointercursor">email</li> <li id="letterbutton" class="pointercursor">letter</li> </ul> </button>
any please?
this 1 works, adjusted css little, moved #nav:hover .myclassul{
rule after .myclassul
, added hover rule drop down items
#nav { margin: 0; text-align: left; color: #333; position: relative; } #nav ul { padding: 0; margin: 2px; list-style-type: none; text-align: left; display: none; } #nav ul li{ margin: 0; padding: 0; color: black; line-height: 21px; position: relative; } .myclassul { min-width: 50px; background: #f2f2f2; display: none; position: absolute; z-index: 999; left: 0; top: 100%; width: 50px; } #nav:hover .myclassul{ display: block; } #letterbutton:hover, #emailbutton:hover { color: #f99; }
<button id="nav" class="selected arrow">communications▼ <ul class="myclassul"> <li id="emailbutton" class="pointercursor">email</li> <li id="letterbutton" class="pointercursor">letter</li> </ul> </button>
Comments
Post a Comment