IE中的样式问题 - 分层导航

时间:2013-02-12 20:29:06

标签: html css styles stylesheet

嘿伙计我有以下内容:

 <ul class='main_nav'>
        <li class='first' style='padding-top:0;'><a href='#' onclick='return false;'><span class='shaper'>Tools</span></a>
            <ul>
                <li class='second'><a href='emailfunction.php'>Email Tool</a></li>
                <li class='second'><a href='insurancetool.php'>Insurance Tool</a></li>
                <li class='second'><a href='monthlyreport.php'>Monthly Report Tool</a></li>
                <li class='second'><a href='statuschanger.php'>Status Change Tool</a></li>
                <li class='second'><a href='addtool.php'>Add Tool</a></li>
                <li class='second'><a href='revisetool.php'>Revise Tool</a></li>
                <li class='second'><a href='csvuploaderform.php'>Upload an Employee List (.csv file)</a></li>
                <li class='second'><a href='csvmanualuploaderform.php'>Upload a Single Employee</a></li>
                <li class='second'><a href='insuranceverificationviewer.php'>View Employee Car Insurance Information</a></li>
            </ul>
        </li>       
 </ul>

所以这是我的导航,这里是样式:

.main_nav {
    display: block;
    float: left;
    width: 118px;
    height: 60px;
    background: #009;
    margin: 0 .5% 0 0;
    padding:0;
    color:black;


}
.main_nav:hover{
    background: lightgray;
    border-top:1px solid #009;
    border-right:1px solid #009;
    border-left:1px solid #009;
    color:#009;
}
.main_nav .first {
    text-align: center;
    width: 100%;
    color:white;
    z-index:9999;
}
.main_nav li a {
    color:white;
    height:60px;
    display: block; 
    z-index:9999;
}
.main_nav a:hover {
    color:black;    
}
.main_nav li {
    list-style:none;
    z-index:9999;
}
.main_nav li:hover {

}
.main_nav ul {
    display:none;
    list-style:none;    
    position:relative;
    float: left;
    z-index:9999;
}
.main_nav li:hover > ul {
    display: block;
    padding:0;
    margin:0;
    position:absolute;
    background: lightgray;
    }
.main_nav  li ul li {
    border-left:1px solid #009;
    border-right:1px solid #009;
    border-bottom:1px solid #009;
    z-index:9999;
}

所以这很好用,除了在IE中,我有这个问题,我有一个绝对的div,它在底部添加一条线。事情是在IE中,该行被放置在您悬停在上方时显示的顶部导航的前面。在谷歌,firefox一切都很棒。

这是酒吧:

<div class="top-backgroundwrap">

</div><!-- top-backgroundwrap -->

.top-backgroundwrap {
    width: 100%;
    height: 20px;
    background: lightgray;
    margin-top: -24px;  
}

我尝试使用z-index并没有成功。我注意到IE正在把它当作最常见的位置:绝对;并且即使在减少索引之后也显示在前面。如果你能帮助我,我会很感激。如果您还有其他需要,请告诉我。

大卫

1 个答案:

答案 0 :(得分:1)

想出来......我必须摆脱绝对位置并在单独的IE样式表中更改一些填充。