IE7 中菜单悬停 z-index 错误
(已解决)
如果您查看此 wip,您会发现菜单悬停状态不会覆盖下面的内容,我不知道为什么会发生这种情况,并且我尝试将 z-index 值添加到 ul 的大部分部分树,包括最外面的导航标签 -
http://staffanestberg.com/lesmarket2/product.php
我是什么 丢失的?
如果更容易的话,这里是特别的部分 -
<div id="menu-wrapper">
<ul id="menu">
<li><a href="#">New arrivals</a>
<ul>
<li><a href="#">Lorem ipsum</a></li>
<li><a href="#">Lorem ipsum</a></li>
<li><a href="#">Lorem ipsum</a></li>
<li><a href="#">Lorem ipsum</a></li>
</ul>
</li>
<li><a href="#">Designers</a>
<ul>
<li><a href="#">Lorem ipsum</a></li>
<li><a href="#">Lorem ipsum</a></li>
<li><a href="#">Lorem ipsum</a></li>
<li><a href="#">Lorem ipsum</a></li>
</ul>
</li>
<li><a href="#">Clothing</a>
<ul>
<li><a href="#">Lorem ipsum</a></li>
<li><a href="#">Lorem ipsum</a></li>
<li><a href="#">Lorem ipsum</a></li>
<li><a href="#">Lorem ipsum</a></li>
</ul>
</li>
<li><a href="#">Shoes </a>
<ul>
<li><a href="#">Lorem ipsum</a></li>
<li><a href="#">Lorem ipsum</a></li>
<li><a href="#">Lorem ipsum</a></li>
<li><a href="#">Lorem ipsum</a></li>
</ul>
</li>
<li><a href="#">Accessories</a>
<ul>
<li><a href="#">Lorem ipsum</a></li>
<li><a href="#">Lorem ipsum</a></li>
<li><a href="#">Lorem ipsum</a></li>
<li><a href="#">Lorem ipsum</a></li>
</ul>
</li>
<li><a href="#">Blog</a></li>
<li><a href="#">Sale</a></li>
</ul>
</div>
header nav #menu-wrapper {
position: relative;
z-index: 80;
width: 625px;
height: 31px;
text-align: center;
background: transparent url(../images/stripe-menu.gif) no-repeat;
}
header nav #menu-wrapper a,
header nav #menu-wrapper a:active,
header nav #menu-wrapper a:visited,
header nav #menu-wrapper a:hover {
color: #fff;
}
header nav #menu-wrapper #menu {
position: relative;
z-index: 81;
margin: 6px 0 0 0;
display: inline-block;
zoom: 1;
*display: inline;
}
header nav #menu-wrapper #menu li {
position: relative;
z-index: 82;
height: 20px;
margin: 0 20px 0 0;
}
header nav #menu-wrapper #menu ul li:hover a,
header nav #menu-wrapper #menu li:hover li a {
background: none;
}
header nav #menu-wrapper #menu li:hover > ul {
display: block;
}
header nav #menu-wrapper #menu ul {
padding: 10px 15px 10px 15px;
display: none;
width: 140px;
height: 200px;
position: absolute;
top: 20px;
left: -15px;
text-align: left;
z-index: 90;
background-color: #000;
background-color: rgba(0, 0, 0, 0.85);
}
header nav #menu-wrapper #menu ul li:first-child {
border-top: 1px dotted #fff;
}
header nav #menu-wrapper #menu ul li {
float: none;
margin: 0;
line-height: 18px;
}
header nav #menu-wrapper #menu:after {
content: ".";
display: block;
clear: both;
visibility: hidden;
line-height: 0;
height: 0;
}
header nav #menu-wrapper html[xmlns] #menu {
display: block;
}
(Solved)
If you look at this wip you'll see that the menu hover states doesn't overlay the content below, I have no idea why this is happening and I've tried adding z-index values to most parts of the ul tree, including the outer most nav tag -
http://staffanestberg.com/lesmarket2/product.php
What am I missing?
If it's easier here are the parts in particular -
<div id="menu-wrapper">
<ul id="menu">
<li><a href="#">New arrivals</a>
<ul>
<li><a href="#">Lorem ipsum</a></li>
<li><a href="#">Lorem ipsum</a></li>
<li><a href="#">Lorem ipsum</a></li>
<li><a href="#">Lorem ipsum</a></li>
</ul>
</li>
<li><a href="#">Designers</a>
<ul>
<li><a href="#">Lorem ipsum</a></li>
<li><a href="#">Lorem ipsum</a></li>
<li><a href="#">Lorem ipsum</a></li>
<li><a href="#">Lorem ipsum</a></li>
</ul>
</li>
<li><a href="#">Clothing</a>
<ul>
<li><a href="#">Lorem ipsum</a></li>
<li><a href="#">Lorem ipsum</a></li>
<li><a href="#">Lorem ipsum</a></li>
<li><a href="#">Lorem ipsum</a></li>
</ul>
</li>
<li><a href="#">Shoes </a>
<ul>
<li><a href="#">Lorem ipsum</a></li>
<li><a href="#">Lorem ipsum</a></li>
<li><a href="#">Lorem ipsum</a></li>
<li><a href="#">Lorem ipsum</a></li>
</ul>
</li>
<li><a href="#">Accessories</a>
<ul>
<li><a href="#">Lorem ipsum</a></li>
<li><a href="#">Lorem ipsum</a></li>
<li><a href="#">Lorem ipsum</a></li>
<li><a href="#">Lorem ipsum</a></li>
</ul>
</li>
<li><a href="#">Blog</a></li>
<li><a href="#">Sale</a></li>
</ul>
</div>
header nav #menu-wrapper {
position: relative;
z-index: 80;
width: 625px;
height: 31px;
text-align: center;
background: transparent url(../images/stripe-menu.gif) no-repeat;
}
header nav #menu-wrapper a,
header nav #menu-wrapper a:active,
header nav #menu-wrapper a:visited,
header nav #menu-wrapper a:hover {
color: #fff;
}
header nav #menu-wrapper #menu {
position: relative;
z-index: 81;
margin: 6px 0 0 0;
display: inline-block;
zoom: 1;
*display: inline;
}
header nav #menu-wrapper #menu li {
position: relative;
z-index: 82;
height: 20px;
margin: 0 20px 0 0;
}
header nav #menu-wrapper #menu ul li:hover a,
header nav #menu-wrapper #menu li:hover li a {
background: none;
}
header nav #menu-wrapper #menu li:hover > ul {
display: block;
}
header nav #menu-wrapper #menu ul {
padding: 10px 15px 10px 15px;
display: none;
width: 140px;
height: 200px;
position: absolute;
top: 20px;
left: -15px;
text-align: left;
z-index: 90;
background-color: #000;
background-color: rgba(0, 0, 0, 0.85);
}
header nav #menu-wrapper #menu ul li:first-child {
border-top: 1px dotted #fff;
}
header nav #menu-wrapper #menu ul li {
float: none;
margin: 0;
line-height: 18px;
}
header nav #menu-wrapper #menu:after {
content: ".";
display: block;
clear: both;
visibility: hidden;
line-height: 0;
height: 0;
}
header nav #menu-wrapper html[xmlns] #menu {
display: block;
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试向您的
#menu-wrapper
添加一个位置:相对/绝对(最适合的)和 z 索引IE7 喜欢最上面的父级具有明确定义的 z 索引允许其子元素与其他元素重叠(具有较低的 z 索引)
IE7不喜欢
rgba
(您的ul
元素)背景颜色。使用后备颜色:.
Try to add to your
#menu-wrapper
a position: relative / absolute (what best suits) and a z-indexIE7 likes when the most top parent has a z-index well defined to allow it's children to overlap other elements (with lower z-index)
IE7 does not like the
rgba
(yourul
elements) background color. Use a fallback color:.