下拉菜单在IE10中无效

时间:2016-03-23 21:39:14

标签: html css internet-explorer

我已经尝试了一段时间来获取我创建的一组下拉菜单。从我所读到的一些内容来看,似乎不支持IE的问题:将鼠标悬停在li元素上。我已经尝试了几种方法,包括jQuery来解决这个问题,但没有一种方法有效。对我来说最奇怪的事情之一是,如果我将完全相同的CSS / HTML用于jsFiddle,它在所有浏览器中都可以正常工作,但如果我将它放入页面并测试它,IE就什么都不做。

这似乎是一个很容易修复的问题,但不知怎的,我还没能找到解决方案。

@import url(http://fonts.googleapis.com/css?family=PT+Sans:400,700);
#main_nav{
    /*background: #4cb6ea;*/
    margin: 0;
    width: auto;
    height: 30px;
    padding: 0;
    line-height: 1;
    display: block;
    position: relative;
    font-family: 'PT Sans', sans-serif;
    font-weight: bold;
    padding-left: 100px;
}

* {
    margin: 0;
    padding: 0;
}

body {
    font: 300 15px/1.5 "Helvetica Neue", helvetica, arial, sans-serif;
    background: #333;
    margin: 15px;
}

article {
    width: 600px;
    margin: 0 auto;
    background: #000;
    color: #fff;
    border-radius: 5px;
    box-shadow: 0 0 15px 2px #666;
}

section {
    clear: left;
}

h1 {
    font-size: 45px;
    font-weight: 100;
    letter-spacing: 15px;
    text-align: center;
}

h1, #main_content, #dog_link {
    padding: 15px;
}

p {
    margin: 15px 0;
}

a {
    color: #06c;
}

#main_nav ul {
    /*background: white;*/
    /*float: left;*/
    -webkit-transition: .5s;
    transition: .5s;
}

#main_nav li {
    float: left;
    position: relative;
    /*width: 175px;*/
    list-style: none;
    -webkit-transition: .5s;
    transition: .5s;
}

#main_nav li ul li{
    float: left;
    position: relative;
    width: 200px;
    list-style: none;
    -webkit-transition: .5s;
    transition: .5s;
}

#main_nav > ul > li > a, h1 {
    text-transform: uppercase;
}

#main_nav a {
    display: block;
    text-decoration: none;
    padding: 5px 15px;
    color: #fff;
}

#main_nav ul ul {
    position: absolute;
    left: 0;
    top: 100%;
    visibility: hidden;
    opacity: 0;
}

#main_nav ul ul ul {
    left: 100%;
    top: 0;
}

#main_nav li:hover, #main_nav li:hover li {
    /*background: #ddd;*/
    background: #A0A0A0;
}

#main_nav li li:hover, #main_nav li li:hover li {
    /*background: #bbb;*/
    background: #353535;
}

#main_nav li li li:hover {
    background: #999;
}

#main_nav li:hover > ul {
    visibility: visible;
    opacity: 1;
}

#main_nav ul li .active a{
    text-decoration: underline;
}


<div id="header">
<a href="/index.php"><div id='logo'></div></a>

<div id='main_nav'>
    <ul>
        <li class=''>
            <a href='#'>About Us</a>
            <ul>
                <li><a href='#'>News</a></li>
                <li><a href='#'>Links</a></li>
            </ul>
        </li>
        <li class=''>
            <a href='#'>Town Departments</a>
            <ul>
                <li><a href='#'>Water Board</a></li>
                <li><a href='#'>Parks and Rec.</a></li>
                <li><a href='#'>Sanitation</a></li>
                <li><a href='#'>Streets</a></li>
            </ul>
        </li>
        <li class=''>
            <a href='#'>Public Safety</a>
            <ul>
                <li>
                    <a href='#'>Fire Dept</a>
                    <ul>
                        <li><a href='/fire_officers-personnel.php'>Officers and Personnel</a></li>
                        <li><a href='/fire_training.php'>Training</a></li>
                        <li><a href='/fire_photos.php'>Photos</a></li>
                    </ul>
                </li>
                <li>
                    <a href='#'>Police Dept</a>
                    <ul>
                        <li><a href='#'>Officers and Personnel</a></li>
                        <li><a href='#'>News</a></li>
                        <li><a href='#'>FAQ</a></li>
                    </ul>
                </li>
            </ul>
        </li>
    </ul>
</div>
</div>

0 个答案:

没有答案