Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/35.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html css-z索引不工作_Html_Css_Firefox - Fatal编程技术网

Html css-z索引不工作

Html css-z索引不工作,html,css,firefox,Html,Css,Firefox,我有这个: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title>Untitled</title> <style> .avatardiv{width:48px;height:48px;z-index:20} .avatardiv a{width:48px;height:48px

我有这个:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
    <title>Untitled</title>

    <style>
    .avatardiv{width:48px;height:48px;z-index:20}
    .avatardiv a{width:48px;height:48px}
    .postdiv{width:100%;margin-top:-48px;z-index:10}
    </style>

</head>

<body>

<div class="avatardiv"><a href="http://google.com"><img src="" /></a></div>
<div class="postdiv">test test test test test test test test test test ....</div>

</body>
</html>

无标题
.avatardiv{宽度:48px;高度:48px;z指数:20}
.avatardiv a{宽度:48px;高度:48px}
.postdiv{宽度:100%;页边顶部:-48px;z索引:10}
测试测试测试测试。。。。
avatardiv的z索引在firefox中不工作。我可以在IE中点击img,但不能在FireFox中点击


有什么解决方案吗?

使用位置:相对属性在使用z索引的地方,我希望它能起作用

    <style>
    .avatardiv{width:48px;height:48px;z-index:20;position:relative}
    .avatardiv a{width:48px;height:48px}
    .postdiv{width:100%;margin-top:-48px;z-index:10;position:relative}
    </style>

.avatardiv{宽度:48px;高度:48px;z指数:20;位置:相对}
.avatardiv a{宽度:48px;高度:48px}
.postdiv{宽度:100%;页边顶部:-48px;z索引:10;位置:相对}

注:z索引仅适用于定位元素(位置:绝对, 位置:相对,或位置:固定)