我有一个带有相对位置元素的问题.问题是我有一个固定位置的标题和相对定位的内容.如果我向下滚动内容,元素将放在标题前面.我尝试使用z-index,但我无法让它工作.我已经戴上z-index:999头了.
在这里你可以看到我的jsFiddle
这是一张图片:

Kev*_*sox 18
的z-index相对定位的元件上应比下z-index固定位置元件上.这是一个简单的例子:
HTML
<div id="fixed">Fixed Position</div>
<div id="relative">Relative Position</div>
Run Code Online (Sandbox Code Playgroud)
CSS
body{
height: 3000px;
}
#fixed{
top: 0;
height; 100px;
background: green;
width: 100%;
position: fixed;
z-index: 2;
}
#relative{
position: relative;
top: 100px;
left: 50px;
height: 100px;
width: 100px;
background: red;
z-index: 1;
}
Run Code Online (Sandbox Code Playgroud)
工作示例: http ://jsfiddle.net/XZ4tM/1/
标题样式有一个问题,有两个冒号::继续z-index属性值.
.header{
width:960px;
background: #43484A;
height:80px;
position: fixed;
top:0;
z-index: 9999; /* Removed extra : here */
}
Run Code Online (Sandbox Code Playgroud)
修复示例 http://jsfiddle.net/kUW66/2/