3

I have a problem with two divs that have position: fixed.

If you look at the header, the scrollbar is in the back and the header is on top of the scrollbar. How can I fix this?

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> 

Code: http://jsfiddle.net/Z6Pwg/

2
  • 1
    never saw that before, very interested in the answer Commented Jun 29, 2013 at 18:21
  • You can fix it by creating a layout without making everything on the page position: fixed. The browser's scrollbar cannot be overlapped, unlike a div's scrollbar. Commented Jun 29, 2013 at 18:34

2 Answers 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/

Sign up to request clarification or add additional context in comments.

7 Comments

yes i see that ... but how i can do something that way or some fix ... right now the only fix what i find its make ".BG2 #Header" to be width: 99% so he have the space for scrollbar ... the problem its if you want to add box-shadow will be a problem ...
does removing position: fixed from the div not solve the problem?
i find one way how to fix the problem ... how i say up .. to make the width = 99% becouse scrollbar its 1%, how much i see its working ... ( sorry for my bad english )
Just resize the window this the result you will notice that scrollbar is not always 1%. And in different browsers you will see different result. Each browser has different scrollbar width. You have chosen the wrong way. Does my solution not work for you?
did you try this link jsfiddle.net/Z6Pwg/1 ? it works in chrome and firefox.
|
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

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.