html - Drop down navigation space between the drops create error -
i have made drop down menu website i'm creating, looks nice think, though there 1 px space between horizontal nav bar , vertical drop down bars. when hover mouse on space vertical menu disappears again , since put mouse on 1 px space it's confusing users.
this html;
<div class="nav"> <div class="links"> <ul id="dropdown"> <li class="currentpage"> <a href="index.html"> tetterode </a> <ul> <li><a href="project.html">project</a></li> <li><a href="promenade.html">promenade</a></li> <li><a href="brochure.html">brochure</a></li> <li><a href="impressies.html">impressies</a></li> </ul> </li> <li> <a href="">woningen</a> <ul> <li><a href="oplevering.html">oplevering</a></li> <li><a href="impressies.html">impressies</a></li> <li><a href="kavelkaart.html">kavelkaart</a></li> </ul> </li> <li> <a href="">locatie</a> <ul> <li><a href="ligging.html">ligging</a></li> <li><a href="routeplanner.html">routplanner</a></li> <li><a href="situatie.html">situatie</a></li> </ul> </li> <li> <a href="">financiering</a> <ul> <li><a href="hypotheken.html">hypotheken</a></li> <li><a href="fiscaal.html">fiscale mogelijkheden</a></li> </ul> </li> <li> <a href="">contact</a> <ul> <li><a href="makelaars.html">makelaars</a></li> <li><a href="gegevens.html">gegevens</a></li> </ul> </li> </ul> </div> </div>
and css;
.nav{ width: 100%; height:50px; background-image:url("bg.jpg"); background-repeat:repeat; text-align:center; padding-bottom:0px; margin-bottom:0px; } .links ul li { list-style-type: none; padding-right: 17px; height:50px; position:relative; display:inline-block; padding-top:0px; line-height:50px; padding-left:17px; text-shadow: 3px 3px 2px rgba(0, 0, 0, 0.50); margin-top:0px; } .links ul li:hover { height:50px; background-color:#b2071a; display:inline-block; margin:0px; } .links { text-transform:uppercase; font-family:helvetica; font-size:18px; color:#fff; display:inline-block; font-size:20px; text-decoration:none; } .links a:hover { background-color:transparent; } #dropdown ul{ background-color:#b2071a; list-style:none; position:absolute; left:-9999px; z-index:20; font-size:16px; padding-top:0px; margin-top:0px; } #dropdown ul li{ float:none; } #dropdown ul a{ white-space:nowrap; font-size:16px; } #dropdown li:hover ul{ left:0; } #dropdown li:hover a{ text-decoration:underline; } #dropdown li:hover ul a{ text-decoration:none; } #dropdown li:hover ul li a:hover{ color:#000; } .currentpage{ height:50px; background-color:#b2071a; display:inline-block; }
i don't see margin/padding causes 1 px space , don't know how solve this. hope can me, thank you.
your code , style sheet pretty good, easy read , follow.
a solution tweak top margin of #dropdown ul
-2px
follows:
#dropdown ul{ background-color:#b2071a; list-style:none; position:absolute; left:-9999px; z-index:20; font-size:16px; padding-top:0px; margin-top:-2px; }
negative margins allowed , can quite useful. problem encountered quite common in pull-down menus , fix typical one.
for reference, see fiddle: http://jsfiddle.net/audetwebdesign/ygn6x/
Comments
Post a Comment