IE z-index相对/列表中的绝对错误 [英] IE z-index relative/absolute bug in list

查看:130
本文介绍了IE z-index相对/列表中的绝对错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下导航其中.topNav有position:relative和subnav有position:absolute。我不能得到子列表出现在主列表由于z-index问题。这似乎是一个已知的问题。

I have the following navigation where .topNav has position:relative and subnav has position:absolute. I cant get the sublist to appear over the main list due to z-index problems. This seems to be a known problem.

<ul>
<li class="topNav">About Us
<ul class="subNav"><li> Subsection A</li><li>Subsection B</li></ul>
</li>
</ul>

有人知道解决方法吗?

更新 http://brh.numbera .com / experiments / ie7_tests / zindex.html 显示了我所遇到的问题。我的原始发布是在列表的上下文中,但我已经减少了问题,z-index dosn't似乎工作,当一个元素与position:absolute在一个父元素的位置:relative

UPDATE http://brh.numbera.com/experiments/ie7_tests/zindex.html shows exacly the problem I have. My original posting was in the context of a list but I have reduced the problem to the fact that z-index dosn't seem to work when have an element with position:absolute inside a parent element with position:relative

推荐答案

这里有一篇很好的文章,解释了machineghost提到的堆叠问题。

Here's a very good article that explains the stacking issues that machineghost mentions.

http://css-discuss.incutio.com /?page = OverlappingAndZIndex

您可能需要考虑什么(取决于您想要在多个元素上进行定位的原因) .base(使用JavaScript的IE6)添加类给它相对性。

What you might want to consider (depending on why you're wanting the positioning on multiple elements) is adding a hover selector to .base (use JavaScript for IE6) that adds the class to give it relativity.

.base:hover{position:relative;}

这意味着第二个.base没有position:relative。

This then means that the second .base doesn't have position: relative.

这篇关于IE z-index相对/列表中的绝对错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆