html - Overflow-x in nested flexbox -
this question has answer here:
i'm trying make central panel scrollable area (x , y) within nested flexbox item.
html, body { width: 100%; height: 100%; margin: 0; color: #fff; } .layout { display: flex; align-items: stretch; flex-wrap: nowrap; width: 100%; } .layout.horizontal { flex-direction: row; } .layout.vertical { flex-direction: column; } .pane { position: relative; flex: 1; } .fill { min-height: 100%; height: 100%; } .scrollable { overflow-x: auto; overflow-y: auto; } .content { background-color: salmon; display: flex; justify-content: center; align-items: center; width: 200px; height: 200px; } /* colour highlighting */ .layer1 > .pane:nth-child(1) { background-color: steelblue; } .layer1 > .pane:nth-child(2) { background-color: plum; } .layer1 > .pane:nth-child(3) { background-color: lightsteelblue; } .layer2 > .pane:nth-child(1) { background-color: darkseagreen; } .layer2 > .pane:nth-child(2) { background-color: seagreen; } .layer2 > .pane:nth-child(3) { background-color: lightseagreen; }
<div class="layout horizontal fill layer1"> <div class="pane"> left </div> <div class="pane"> <div class="layout vertical fill layer2"> <div class="pane"> top </div> <div class="pane scrollable"> <div class="content">content</div> </div> <div class="pane"> bottom </div> </div> </div> <div class="pane"> right </div> </div>
note: expand sample full window mode.
in non-nested scenarios horizontal scrolling works fine central panel:
however when nested, horizontal scrolling central panel not activate expected. seems case chrome, firefox , edge. funnily enough works expected in ie11, suggests modern browsers correctly interpreting specification unknown me.
what missing?
update: seems setting overflow:auto on outer central column required. behaves expected. why this?
don't know if know want, did try put @media
in css , put overflow-x:scroll
?
Comments
Post a Comment