【发布时间】:2013-05-28 07:03:12
【问题描述】:
在“固定”定位元素上使用 z-index CSS 属性会给我在 Chrome 下的奇怪行为。
当 Firefox 和 Opera 浏览器给我期待的结果时,Chrome 似乎不尊重 z-index 属性,在红色覆盖层上方显示滚动条(请参阅下面的代码和小提琴)。
HTML:
<div class="left">
<div class="placeholder"></div>
</div>
<div class="right"></div>
<div class="overlay"></div>
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;
}
操作系统:Apple Mac OS 10.8 谷歌浏览器:版本 27.0.1453.93
有没有人遇到过同样的问题,或者有办法解决这个问题?
提前感谢您的帮助。
编辑:
请参阅此screenshot 了解该问题的概述。
【问题讨论】:
-
它在我的 windows chrome 版本 27 中显示正常
-
我认为问题出在 Mac OS 自动隐藏滚动条上。
-
太糟糕了,这个问题还没有答案。我也对答案感兴趣……
标签: css google-chrome scrollbar z-index