I have the following element:
-
#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)