How to simulate 'position:fixed' behavior on Flexbox-aligned sidebar

后端 未结 1 1655
遇见更好的自我
遇见更好的自我 2020-12-08 11:08

As it was already answered (How can I have a position: fixed; behaviour for a flexbox sized element?) absolutely/fixed positioned boxes are taken out of the normal flow of F

1条回答
  •  星月不相逢
    2020-12-08 12:04

    Edit:

    A solution that somehow feels less hacky could be to make the container (.wrapper) as tall as the screen, and only add scrolling to the main

    element:

    .wrapper {
        display: flex;
        height: 100vh;
    }
    
    section {
        flex: 1 1 auto;
        overflow: auto;
    }
    

    http://codepen.io/Sphinxxxx/pen/WjwbEO

    Original answer:

    You could simply put everything inside

    0 讨论(0)
提交回复
热议问题