I'm having trouble to to style my layout like I want it to. I have a content area #content
(the grey you can see in the example image) with a yellow element inside. This div is position:static;height:100%;
. Now I have a #left-panel
div also, with position:fixed;height:100%;
. The problem is, if the content area has not enough space a horizontally scrollbar appears. This will be overlaped of the fixed div. For me it is all logically, but I don't know how to get around this. My scrollbar of the #content
-element should be visible the whole width of the window. So it would not be a solution for me to just reduce the width of the content if the panel is in view.
The whole css:
#content{
width:100%;
height:100%;
background:grey;
}
#left-panel{
position:fixed;
top:0;
left:0;
width:300px;
height:100%;
overflow-y:auto;
}
Can somebody help me fixing this with pure CSS?
Fiddle: http://jsfiddle.net/a2wn8x5z/1/
Your wrapper element is position:fixed;
I think that you are talking about a overlay with a navigation panel on the left. Well, I had a similar situation and found out, that you can't use position:fixed;
if your parent element is also position:fixed;
. This will overlap the scrollbar of the parent wrapper (the overlay).
So you have to use position:absolute;
instead or use this open source plugin to remove the width/height of the scrollbar from your element:
Scrollbar Fixer
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With