在Firefox 2中,overflow:hidden的使用使得其他div与当前div重叠

时间:2010-06-05 19:19:56

标签: css overflow css-position firefox2

当我使用overflow:hidden为绝对定位的div(对于菜单)时,其他div重叠。这是代码。它在FF3中工作正常。任何帮助赞赏。请注意,html应该是原样。此外,如果您可以提供解决方案,只需更改菜单div的样式(包含菜单文本的div),它对我更有帮助。提前致谢

以下是代码:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>Title of the document</title>
</head>

<body>
<div style="position:relative">
    <div>
        <div style="height:20px;overflow:hidden">
            <div style="position:absolute;width:200px;height:100px;top:0px;background-color:black;z-index:1">menu</div>
        </div>    
    </div>

    <div style="position:relative;height:200px;background-color:gray;"></div>
</div>
</body>

</html> 

1 个答案:

答案 0 :(得分:0)

显然,FF2在overflowz-index方面存在一些已知问题。 (见this google search

可能有一种解决方法,但我们必须知道您要使用overflow: hidden完成的工作。很难从你的代码中分辨出来,因为它实际上没有效果 - 删除overflow:hidden完全得到了你想要的结果。