How to put scroll bar only for modal-body?

后端 未结 13 1174
悲哀的现实
悲哀的现实 2020-11-30 18:14

I have the following element:

相关标签:
13条回答
  • 2020-11-30 18:43
    #scroll-wrap {
        max-height: 50vh;
        overflow-y: auto;
    }
    

    Using max-height with vh as the unit on the modal-body or a wrapper div inside of the modal-body. This will resize the height of modal-body or the wrapping div(in this example) automatically when a user resize the window.

    vh is length unit representing 1% of the viewport size for viewport height.

    Browser compatibility chart for vh unit.

    Example: https://jsfiddle.net/q3xwr53f/

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