【发布时间】:2011-09-25 15:27:35
【问题描述】:
我有一个名为 header 的 div,它设置了固定位置。问题是当我滚动页面时,页面内容显示在标题后面(标题是透明的)。
我对 css 了解很多,但似乎无法弄清楚这一点。我曾尝试将溢出设置为隐藏,但我知道它不起作用(而且它没有)。
这很难解释,所以我尽我所能。
html:
<div id="header">
<div id="topmenu">Home | Find Feeds | Subscriptions</div>
</div>
<div id="container">
<div id="content">
testing
</div>
</div>
css:
#header {
margin:0 auto;
position: fixed;
width:100%;
z-index:1000;
}
#topmenu {
background-color:#0000FF;
height:24px;
filter: alpha(opacity=50);
opacity: 0.5;
}
#leftlinks {
padding: 4px;
padding-left: 10px;
float: left;
}
#rightlinks {
padding: 4px;
padding-right: 10px;
float: right;
}
#containerfixedtop {
width: 100%;
height: 20px;
}
#contentfixedtop {
margin: 0 auto;
background-color: #DAA520;
width: 960px;
height:20px;
}
#container {
position: relative;
top: 68px;
width: 100%;
height: 2000px;
overflow: auto;
}
#content {
margin: 0 auto;
background-color: #DAA520;
width: 960px;
height: 2000px;
}
这是问题的截图:
【问题讨论】:
-
你能得到问题的截图吗?
-
可以添加css和html吗?
-
@mtlca401:您找到最终解决方案了吗?我有类似的问题
-
您是否尝试过在透明背景上禁用用户事件。
-
请看我这篇文章中的解决方案:The Solution