Grow your CSS skills. Land your dream job.

[Solved] IE7 dropdown menu problems

  • # January 5, 2010 at 2:15 pm

    Can anyone help me?
    I can get my menu to work in all browsers except ie7.
    In ie7 all of the menu items shift to the left and stack on top of one and other.

    The page is here…
    http://www.erdengines.com/newsite/

    Here is a sample image of what is happening…
    [img]http://www.erdengines.com/ie7.jpg[/img]

    Here is the code I am using…

    Code:
    .menu {background: url(images/carbon-bg.jpg); min-height:30px; position:relative; z-index:100; border-right:1px solid #000; font-family: Arial, Helvetica, sans-serif;}
    /* hack to correct IE5.5 faulty box model */
    * html .menu {}
    /* remove all the bullets, borders and padding from the default list styling */
    .menu ul {padding:0;margin:0;list-style-type:none;}
    .menu ul ul { display: inline; }
    /* float the list to make it horizontal and a relative positon so that you can control the dropdown menu positon */
    .menu li {display:inline; float:left; position:relative;}

    /* style the links for the top level */
    .menu a, .menu a:visited {display:inline;display:block;font-size:13px;text-decoration:none; white-space:nowrap; color:#fff; height:30px; border:1px solid #000; border-width:0px 0 1px 1px; padding-left:10px; padding-right: 10px; line-height:29px;}
    /* a hack so that IE5.5 faulty box model is corrected */
    * html .menu a, * html .menu a:visited {}

    /* hide the sub levels and give them a positon absolute so that they take up no room */
    .menu ul ul {visibility:hidden;position:absolute;height:0;top:31px;left:0; width:149px;border-top:1px solid #000;}
    /* another hack for IE5.5 */
    * html .menu ul ul {top:30px;top:31px;}

    /* position the third level flyout menu */
    .menu ul ul ul{left:149px; top:-1px; width:149px;}

    /* position the third level flyout menu for a left flyout */
    .menu ul ul ul.left {left:-149px;}

    /* style the table so that it takes no part in the layout – required for IE to work */
    .menu table {position:absolute; top:0; left:0; border-collapse:collapse;}

    /* style the second level links */
    .menu ul ul a, .menu ul ul a:visited {background: url(menu_wht-bg.png); color:#000; height:30px; line-height:29px; padding-left:5px; padding-right: 20px; width: auto;border-width:0 1px 1px 1px;}
    /* yet another hack for IE5.5 */
    * html .menu ul ul a, * html .menu ul ul a:visited {}

    /* style the top level hover */
    .menu a:hover, .menu ul ul a:hover{color: #FF0; background: url(menu-bg.png);}
    .menu :hover > a, .menu ul ul :hover > a {color: #FF0; background: url(menu-bg.png);}

    /* make the second level visible when hover on first level list OR link */
    .menu ul li:hover ul,
    .menu ul a:hover ul{visibility:visible; }
    /* keep the third level hidden when you hover on first level list OR link */
    .menu ul :hover ul ul{visibility:hidden;}
    /* make the third level visible when you hover over second level list OR link */
    .menu ul :hover ul :hover ul{ visibility:visible;}

    # January 7, 2010 at 7:38 am

    Solved it myself, thanks!

    # January 31, 2010 at 7:38 am

    Well don’t be a prick and share Your resolution! I have the same problem

    # January 31, 2010 at 7:56 am

    As he might not come back and look at this post, I looked at his link and the error is still there in IE7. To get rid of it remove width:0px from .menu LI
    This may have nothing to do with your problem however. :)

    # January 31, 2010 at 8:16 am

    Thanks for the effort "virtual" but yes, thats not my solution! i’ll have to open another thread!

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".