css下拉不工作即

时间:2013-11-22 01:21:04

标签: css internet-explorer drop-down-menu

以下HTML和CSS制作了一个简单的下拉菜单,可以在Chrome和Firefox中使用,但在IE中不起作用(当一个鼠标悬停在下拉链接上时,下拉列表不会出现)

任何人都可以帮我解决这个问题吗?

谢谢:)

HTML:

<link rel="stylesheet" href="style.css">

<div id="topMenu">
    <div class="drop">
    <ul class="drop_menu">
    <li><a href='#'>Home</a>
    </li>
    <li><a href='#'><?php echo $catTitle; ?> Services</a>
        <ul>
        <li><a href='/category/category1/'>category1</a></li>
        <li><a href='/category/category2/'>category2</a></li>
        <li><a href='/category/category3/'>category3</a></li>
        <li><a href='/category/category4/'>category4</a></li>
        <li><a href='/category/category5/'>category5</a></li>
        <li><a href='/category/category6/'>category6</a></li>
        </ul>   
    </li>
    <li><a href='#'>Specialist Services</a>
        <ul>
        <li><a href='/category/category1/'>category1</a></li>
        <li><a href='/category/category2/'>category2</a></li>
        <li><a href='/category/category3/'>category3</a></li>
        <li><a href='/category/category4/'>category4</a></li>
        <li><a href='/category/category5/'>category5</a></li>
        <li><a href='/category/category6/'>category6</a></li>
        </ul>
    </li>
    <li><a href='#'>About Us</a>
        <ul>
        <li><a href='#'>Company Profile</a></li>
        <li><a href='#'>Reviews</a></li>
        <li><a href='#'>Legal Info</a></li>
        <li><a href='#'>Terms & Conditions</a></li>
        </ul>
    </li>
    <li><a href='#'>Track A Shipment</a>
    </li>
    </ul>
    </div>
</div>

CSS:

/* Layout for the TOP menu */

.drop {
width: 970px;
margin: 0 auto;
height: 35px;
}

.drop_menu {
    background:#005555;
    padding:0;
    margin:0;
    list-style-type:none;
    height:35px;
}
.drop_menu li { float:left; }
.drop_menu li a {
    padding:9px 20px;
    display:block;
    color:#fff;
    text-decoration:none;
    /*font:12px arial, verdana, sans-serif;*/
}

/* Submenu */
.drop_menu ul {
    position:absolute;
    left:-9999px;
    top:-9999px;
    list-style-type:none;
}
.drop_menu li:hover { position:relative; background:#06266f; }
.drop_menu li:hover ul {
    left:0px;
    top:35px;
    background:#06266f;
    padding:0px;
}

.drop_menu li:hover ul li a {
    padding:5px;
    display:block;
    width:185px;
    text-indent:5px;
    background-color:#707070;
}
.drop_menu li:hover ul li a:hover { background:#06266f; }









/* End of top menu layout */

1 个答案:

答案 0 :(得分:0)

对于oldIE悬停支持,请使用whatever:hover

更好的是,使用ie9.js修复所有oldIE怪癖。