100% height div and overflow:auto

后端 未结 5 1176
既然无缘
既然无缘 2021-02-12 12:55

I have got a vertical menu on the left side of the screen, and i want to take 100% height of the resolution, but if the div(of the menu) needs more, i want to appear scroll. My

5条回答
  •  花落未央
    2021-02-12 13:28

    There is a farily simple answer to this, using height: 100% on both the HTML and body selectors in CSS, you can effectively tell the menu to be 100% of the height, but scroll when it needs to.

    I have made an example for you here at jsFiddle.net. (resize the Result window to see the effect)

    Hope it helps :)

提交回复
热议问题