3

我对两个具有position: fixed.

如果你看标题,滚动条在后面,标题在滚动条的顶部。我怎样才能解决这个问题?

HTML:

<div class="BG1">
 <div class="Data"></div>
</div>

<div class="BG2">
 <div id="Header">
  <div class="Header_Data"></div>
 </div>
 <br />a<br /><br />a<br /><br />
</div>

代码:http: //jsfiddle.net/Z6Pwg/

4

2 回答 2

2

I simplified your example: http://jsfiddle.net/uVjft/

So actually you have on position: fixed block inside another. And the scrollbar corresponds to BG2 block NOT the window scrollbar which actually cannot be overlapped.

To fix this try to remove position: fixedfrom BG2 div: http://jsfiddle.net/Z6Pwg/1/

于 2013-06-29T18:35:08.757 回答
0

just include the code

  .BG2 #Header .Header_Data {
   width: 100%;
   height: 120px;
   overflow: hidden;
  background-color:#eee;

}

in your css it will fix your issue, and if u want a fixed header don't use transparent background


Thanks

于 2014-02-03T09:24:06.137 回答