SpinOneSolutions | I waste my time so that you don’t have to…

Feb/09

24

CSS hover menu sticking open

Problem

Are your CSS hover menus sticking open in IE after the mouse has left the hit region?

Solution

Given the following markup:

<ul id="nav">
  <li>
    <div class="dropdown">
      <ul>
        <li>NavItem</li>
      </ul>
    </div>
  </li>
</ul>

IE doesn’t like hiding via the off screen positioning method.

#nav ul {
position:absolute;
left:-999px;
}
#nav div.drop:hover ul
{
  left:0;
}

So we’ll just switch it to use the display property instead.

#nav ul {
position:absolute;
display:none;
}
#nav div.drop:hover ul
{
  display:block;
}
Share and Enjoy:
  • Print
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • DZone
  • Kirtsy
  • Propeller
  • Reddit
  • Slashdot
  • StumbleUpon
  • Suggest to Techmeme via Twitter
  • Technorati

RSS Feed

1 Comment for CSS hover menu sticking open

nathan | July 15, 2010 at 3:21 pm

oh yea…. this is very useful.. thank you very much..

Leave a comment!

«

»

Find it!

Theme Design by devolux.org