纯CSS下拉菜单在IE8中未正确显示

纯CSS下拉菜单在IE8中未正确显示,css,drop-down-menu,internet-explorer-8,Css,Drop Down Menu,Internet Explorer 8,我的纯css下拉菜单适用于除IE8之外的所有主要浏览器。有两个问题 1) 直到鼠标滚动到其中一个菜单项上,菜单的背景色才会显示。(见下面链接中的照片) 2) 如果从父链接(治疗)退出菜单,则会留下背景显示的缩短版本。(见下面链接中的照片) CSS: .menu, .menu ul, .menu li, .menu a { margin: 0; padding: 0; border: none; outline: none; z-index:3; } .

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

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

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

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;
}
<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>
HTML:

.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;
}
<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>
    • 皮肤重铺
    • 收紧皮肤
    • 脂肪团治疗
    • 注射剂
    • 其他

  • 我记得IE理解:只为“a”标记悬停
  • :最后一个孩子也不支持

为了帮助您,您需要发布代码……您应该留下一些代码块。仅仅基于这些图片,人们可能很难提供帮助。我认为IE8支持:悬停其他元素,但不支持:last-child。是的,你是对的,因为IE8:悬停其他元素起作用。是我的错。