Scroll bar inside fixed 100% div without javascript

So, I have a fixed divon the right side of the screen, which is the height window. When the content exceeds the space div, I want it to divoverflow with scrollbar.

I managed to do this in Chrome, but it does not work in Firefox.

Sscce

HTML:

<div id="outer">
    <div id="middle">
        <div id="inner">
        </div>    
    </div>
</div>

CSS:

div#outer{
    position    : fixed;
    top         : 0;
    right       : 0;
    display     : table;
    z-index     : 200;
    width       : 320px;
    height      : 100%;
}

div#middle {
    display     : table-cell !important;
    max-width   : 300px;
max-height  : 100%;
}

div#inner {
    overflow-y: auto;
    height: 100%;
}

Why is this not working? What can I do to fix this?

I understand that I could bind the event to the window reorientation and force the height on it div, but I would prefer a solution CSS.

+4
source share
1 answer

: auto; . http://jsfiddle.net/NicoO/49SY8/

body, html
{
    margin:0;
    padding:0;
    height:100%;
}

div#outer{
    position    : fixed;
    top         : 0;
    right       : 0;
    z-index     : 200;
    width       : 320px;
    height      : 100%;
}

div#middle {
    max-width   : 300px;
}

div#inner {
    overflow: auto;
    position: absolute;
    bottom:0;
    left:0;
    right:0;
    top:0;
}
+9

Source: https://habr.com/ru/post/1529883/


All Articles