Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to enable scrolling of content inside a modal?

I'm trying to fit a lot of text into a modal box created using Twitter Bootstrap, but I'm having a problem: that content refuses to scroll.

I tried adding overflow:scroll and overflow-y:scroll, but to no avail; that merely causes it to display a scroll bar without actually enabling the scrolling.

What's the cause behind that and what can I do?

like image 236
user798204 Avatar asked Sep 22 '11 01:09

user798204


People also ask

How do I make content inside modal scrollable?

Bootstrap 4.3 added new built-in scroll feature to modals. This makes only the modal-body content scroll if the size of the content would otherwise make the page scroll. To use it, just add the class modal-dialog-scrollable to the same div that has the modal-dialog class.

How do I make a scrollable model?

For vertical scrollable bar use the x and y axis. Set the overflow-x:hidden; and overflow-y:auto; that will automatically hide the horizontal scroll bar and present only vertical scrollbar. Here the scroll div will be vertically scrollable.

What prevents the body from scrolling when a modal is opened?

Approach: A simple solution to this problem is to set the value of the “overflow” property of the body element to “hidden” whenever the modal is opened, which disables the scroll on the selected element.

How do I scroll in material UI modal?

You need to use 'overflow = scroll' for modal style. Below is example code to get scrollable material-ui modal. withStyles is used to apply style for modal in this example.


1 Answers

In Bootstrap.css change the background attribute (position) of Modal from fixed to absolute

like image 126
jktress Avatar answered Sep 19 '22 22:09

jktress