小编Vin*_*let的帖子

Chrome下滚动条的奇怪z-index行为

在"固定"定位元素上使用z-index CSS属性在Chrome下给我一个奇怪的行为.

当Firefox和Opera浏览器给我等待结果时,Chrome似乎不尊重z-index属性,在红色叠加层上方显示滚动条(参见代码和Fiddle bellow).

HTML:

<div class="left">
    <div class="placeholder"></div>
</div>
<div class="right"></div>
<div class="overlay"></div>
Run Code Online (Sandbox Code Playgroud)

CSS:

.left {
    background-color: yellow;
    bottom: 0;
    left: 0;
    overflow: auto;
    position: fixed;
    top: 0;
    width: 35%;
    z-index: 10;
}

.right {
    background-color: orange;
    bottom: 0;
    position: fixed;
    right: 0;
    top: 0;
    width: 65%;
    z-index: 20;
}

.overlay {
    background-color: red;
    bottom: 20%;
    left: 25%;
    position: fixed;
    right: 25%;
    top: 20%;
    z-index: 40;
}

.placeholder {
    height: 3000px;
}
Run Code Online (Sandbox Code Playgroud)

示例:http: //jsfiddle.net/kvNFW/

操作系统:Apple Mac OS …

css google-chrome z-index scrollbar

27
推荐指数
1
解决办法
2万
查看次数

标签 统计

css ×1

google-chrome ×1

scrollbar ×1

z-index ×1