[英]Why has my simple CSS Z-index stopped working?
My page has elements class .fixed with a z-index of 1 and a #container with a z-index of 2, and this worked correctly until recently when they appear to have reversed. 我的页面有元素类.fixed为z-index为1,#settainer为z-index为2,直到最近它们看起来已经颠倒了。 I can't figure out what change to the code has caused this.
我无法弄清楚代码的变化导致了什么。 Can you take a look?
你能看看吗?
http://www.bewe.me/ http://www.bewe.me/
The text is .fixed and the photos are in the #container. 文本是.fixed,照片在#container中。 For me the photos scroll underneath the text instead of over it like they should.
对我来说,照片在文本下面而不是像它们应该的那样滚动。 I've only tried on Chrome, though.
不过,我只试过Chrome。
Give your #container
element a position: relative;
给
#container
元素一个position: relative;
and your problem should go away. 你的问题应该消失。 You may also find this expository piece on
z-index
helpful. 您也可以在
z-index
上找到这个说明文章 。
Something with a position:fixed
selector will be above a position:static
(the default) block element. 具有
position:fixed
东西position:fixed
选择器将位于position:static
上方position:static
(默认)块元素。 The fix for this case, would be to make the div id container relatively positioned. 这种情况的修复方法是使div id容器相对定位。 (
#container { position:relative; }
) (
#container { position:relative; }
)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.