css - 纯 CSS 下拉菜单在 IE8 中无法正常显示

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

我的纯 css 下拉菜单适用于除 IE8 之外的所有主流浏览器。有两个问题。

1) 直到鼠标滑过其中一个菜单项时,菜单的背景色才会显示。 (见下面链接中的照片)

http://www.searchtransparency.net/stackoverflow/2.jpg

2) 如果从父链接(治疗)退出菜单,它会留下一个缩短的背景显示版本。 (见下面链接中的照片)

http://www.searchtransparency.net/stackoverflow/1.PNG

CSS:

.menu,
.menu ul,
.menu li,
.menu a {
    margin: 0;
    padding: 0;
    border: none;
    outline: none;
    z-index:3;
}
.menu {
    height: 53px;
    width: 994px;
}
.menu li {
    position: relative;
    list-style: none;
    float: left;
    display: block;
    height: 38px;
    padding-top: 15px;
}
.menu li a {
    display: block;
    padding-left: 44px;
    padding-right: 44px;
    -webkit-transition: color .2s ease-in-out;
    -moz-transition: color .2s ease-in-out;
    -o-transition: color .2s ease-in-out;
    -ms-transition: color .2s ease-in-out;
    transition: color .2s ease-in-out;
    margin-top: 0px;
    margin-right: 0;
    margin-bottom: 0px;
    margin-left: 0;
    padding-top: 0;
    padding-bottom: 0;
}
.menu li:first-child a { border-left: none; }
.menu li:last-child a{ border-right: none; }
.menu li:hover > a { color:#CCC; }
.menu ul {
    position: absolute;
    top: 53px;
    left: 0;
    opacity: 0;
    -webkit-border-radius: 0 0 5px 5px;
    -moz-border-radius: 0 0 5px 5px;
    border-radius: 0 0 5px 5px;
    -webkit-transition: opacity .25s ease .1s;
    -moz-transition: opacity .25s ease .1s;
    -o-transition: opacity .25s ease .1s;
    -ms-transition: opacity .25s ease .1s;
    transition: opacity .25s ease .1s;
    -webkit-box-shadow: 0px 0px 5px 0px #333;
    box-shadow: 0px 0px 5px 0px #333;
    background-color: #222;
    padding-bottom: 15px;
    visibility: hidden;
    behavior: url(PIE.htc);
}
.menu li:hover > ul {
    opacity: 1;
    visibility: visible;
}
.menu ul li {
    height: 0;
    overflow: hidden;
    padding: 0;
    -webkit-transition: height .25s ease .1s;
    -moz-transition: height .25s ease .1s;
    -o-transition: height .25s ease .1s;
    -ms-transition: height .25s ease .1s;
    transition: height .25s ease .1s;
}
.menu li:hover > ul li {
    height: 25px;
    overflow: visible;
}
.menu ul li a {
    width: 175px;
    margin: 0;
    font-size: 12px;
    text-shadow: none;
    border: none;
    padding-left: 25px;
    height: 20px;
    padding-top: 5px;
}
.menu ul li:last-child a { border: none; }
.menu li li:hover > a {
    background-color: #666;
}

HTML:

<ul class="menu">
    <li><a href="index.html" title="Home"><img src="images/icon-home.png" alt="Home" width="18" height="18" border="0"></a></li>
    <li><a href="meet-the-doctor.html" title="Meet The Doctor">Meet The Doctor</a></li>
    <li class="icon-dropdown-arrow"><a href="#" title="Treatments">Treatments</a>

        <ul>
            <li style="font-size:14px; padding-left:15px; padding-top:10px; margin-top:10px;">Skin Resurfacing</li>
            <li><a href="fraxel-restore.html" title="Fraxel Restore">Fraxel&reg; Restore</a></li>
            <li style="font-size:14px; padding-left:15px; padding-top:10px; margin-top:0px;">Skin Tightening</li>
            <li><a href="thermage.html" title="Thermage">Thermage&reg;</a></li>
            <li><a href="refirme-photo-rejuvenation.html" title="Refirme Photo-Rejuvenation">Refirme&reg; Photo-Rejuvenation</a></li>
            <li style="font-size:14px; padding-left:15px; padding-top:10px; margin-top:0px;">Cellulite Treatments</li>
            <li><a href="lpg-lipomassage.html" title="LPG Lipomassage">LPG Lipomassage&trade;</a></li>
            <li><a href="velashape.html" title="VelaShape">VelaShape&trade;</a></li>
            <li><a href="thermage.html" title="Thermage">Thermage&reg;</a></li>
            <li><a href="ionithermie-treatment.html" title="Ionithermie Treatment">Ionithermie Treatment</a></li>
            <li style="font-size:14px; padding-left:15px; padding-top:10px; margin-top:0px;">Injectibles</li>
            <li><a href="dermal-fillers.html" title="Dermal Fillers">Dermal Fillers</a></li>
            <li><a href="botox-cosmetic.html" title="Botox Cosmetic">Botox&reg; Cosmetic</a></li>
            <li style="font-size:14px; padding-left:15px; padding-top:10px; margin-top:0px;">Other</li>
            <li><a href="laser-hair-removal.html" title="Laser Hair Removal">Laser Hair Removal</a></li>
            <li><a href="skin-treatments.html" title="Skin Treatments (Face &amp; Body)">Skin Treatments (Face &amp; Body)</a></li>
            <li><a href="skin-rejuvenation.html" title="Skin Rejuvenation">Skin Rejuvenation</a></li>
            <li><a href="plastic-surgery.html" title="Plastic Surgery">Plastic Surgery</a></li>
            <li><a href="massage.html" title="Massage">Massage</a></li>
        </ul>

    </li>
    <li><a href="specials.html" title="Specials">Specials</a></li>
    <li><a href="reviews.html" title="Reviews">Reviews</a></li>
    <li><a href="contact.html" title="Contact">Contact</a></li>
</ul>

Code on JsFiddle.net

最佳答案

关于css - 纯 CSS 下拉菜单在 IE8 中无法正常显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13384017/

相关文章:

java - 下拉帮助java

javascript - HTML 中的无效字符阻止我的菜单切换?

jquery - ajax 请求后未触发 IE document.ready()

css - 使用 IE8 在 tbody、thead 和 tfoot 周围设置边界

html - Google 字体的 IE8 文本阴影问题

html - 搜索输入和按钮未正确水平对齐

css - 使用定制的 Bootstrap 框架

html - 在 css 中,父 ul 后面的子 ul

Javascript 样式显示 ='none' 到 'block' 在 iPhone Chrome/Safari 上不起作用

javascript获取div内的所有输入,包括select和textarea