Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/83.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 Android本机浏览器没有';t尊重滚动的z索引_Html_Css_Z Index_Android Browser - Fatal编程技术网

Html Android本机浏览器没有';t尊重滚动的z索引

Html Android本机浏览器没有';t尊重滚动的z索引,html,css,z-index,android-browser,Html,Css,Z Index,Android Browser,我已经设置了一个小提琴来复制这个问题。仅在android本机浏览器中,滚动条适用于绝对定位元素下的元素。它似乎不尊重滚动的z索引 html, body { height: 100%; overflow: hidden; } #scroll { height: 100%; overflow: scroll; } .overlay { height: 100%; width: 100%; background-color: #333; opac

我已经设置了一个小提琴来复制这个问题。仅在android本机浏览器中,滚动条适用于绝对定位元素下的元素。它似乎不尊重滚动的z索引

html, body {
    height: 100%;
    overflow: hidden;
}
#scroll {
    height: 100%;
    overflow: scroll;
}
.overlay {
   height: 100%;
   width: 100%;
   background-color: #333;
   opacity: .4;
   position: absolute;
   z-index: 4;
   left: 0;
   top: 0;    
 }
代码:


结果:

给你的
#滚动
div a
位置:relative
,并设置
z-index:3
或更小的值,以便浏览器尊重最上面的内容。

我对你的CSS做了一些小改动,解决了你遇到的问题:

#滚动
元素上,您不是在定义定位,而是在.overlay元素上用
绝对
定义位置。这加上将值为4的
z-index
属性应用于
.overlay
元素,会导致覆盖层堆叠在
#scroll
元素的顶部。由于覆盖层的高度和宽度均为100%,您导致
#scroll
元素变得不可访问,因为
.overlay
元素完全覆盖了它

#scroll {
   height: 100%;
   overflow: scroll;
}

.overlay {
   height: 100%;
   width: 100%;
   background-color: #333;
   opacity: .4;
   position: absolute;
   z-index: 4;
   left: 0;
   top: 0;
}
基本上,如果浏览器是一张张完全叠在一起的纸,您将无法读取堆栈底部的“access”

如果您正在尝试设置滚动条的样式,我建议您直接查看滚动条的样式。如果没有,您只需在
#滚动
上放置一个位置:relative和一个
z-index:5这将解决此问题


下面是一个JSFIDLE解决方案:

尝试使用z-index:-1;检查你的fiddle@mcmac不。不应发生预期的o/p滚动。只有在android本机浏览器(非chrome)中,div“#scroll”才会出现滚动。