Div at bottom of window and adaptable height div

前端 未结 6 771
半阙折子戏
半阙折子戏 2021-01-03 05:00

Is there a way to get a div to always be at the bottom of the window, and another div to change its height to fill any space that it leaves, and that div will scroll if its

6条回答
  •  盖世英雄少女心
    2021-01-03 05:34

    I don't think this is possible without working out the size of the centre div using Javascript.

    CSS positioning basically flows from the top down, so to get a div to stick at the bottom of the page you need to take it out of the flow of the page using position:absolute (or position:fixed)

    But now that div is out of the flow of the page, so the middle div doesn't know to stop at the top of the bottom div. It will just carry on behind the bottom div and won't display scrollbars.

提交回复
热议问题