1

I created a full screen modal using Bootstrap, when there is too much content I can't scroll. This is my code:

.modal-full {
    min-width: 100%;
    margin: 0;
}

.modal-full .modal-content {
    min-height: 100vh;
}

Full JSFIDDLE.

PUNGIS
  • 53
  • 4
  • This answer may help you https://stackoverflow.com/questions/25874001/how-to-put-scrollbar-only-for-modal-body-in-bootstrap-modal-dialog – Liam McArthur Oct 02 '18 at 09:57
  • Possible duplicate of [How to put scrollbar only for modal-body in bootstrap modal dialog](https://stackoverflow.com/questions/25874001/how-to-put-scrollbar-only-for-modal-body-in-bootstrap-modal-dialog) – Liam McArthur Oct 02 '18 at 09:58

3 Answers3

1

Use overflow: auto; to .modal-full

.modal-dialog {
    position: fixed;
    margin: 0;
    width: 100%;
    height: 100%;
    padding: 0;
}

.modal-full {
    min-width: 100%;
    overflow:auto;
}

    .modal-full .modal-content {
        min-height: 100vh;
    }
 <div class="modal-dialog modal-full">
                                    <div class="modal-content">
                                        <div class="modal-header">
                                            <h4 class="modal-title" id="myModalLabel">Test</h4>
                                            <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                                        </div>
                                        <div class="modal-body">
                                            <h6>Text in a modal</h6>
                                            <p>Duis mollis, est non commodo luctus, nisi erat porttitor ligula.</p>
                                            <hr>
                                            <h6>Overflowing text to show scroll behavior</h6>
                                            <p>Cras mattis consectetur purus sit amet fermentum. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Morbi leo risus, porta ac consectetur ac, vestibulum at eros.</p>
                                            <p>Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor.</p>
                                            <p>Aenean lacinia bibendum nulla sed consectetur. Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Donec sed odio dui. Donec ullamcorper nulla non metus auctor fringilla.</p>
                                        </div>
                                        <div class="modal-footer">
                                            <button type="button" class="btn btn-light" data-dismiss="modal">Close</button>
                                            <button type="button" class="btn btn-primary">Save changes</button>
                                        </div>
                                    </div><!-- /.modal-content -->
                                </div><!-- /.modal-dialog -->
לבני מלכה
  • 15,925
  • 2
  • 23
  • 47
0

Replace your css with this

.modal-full .modal-content {
   min-height: 100vh;
   max-height: 100vh;
   overflow-y: scroll;
}
Abdul Basit
  • 1,352
  • 1
  • 10
  • 18
0

Bootsrap modals have this feature by default.

You just have to make edits to the .modal-dialog and .modal-content classes to make the modal full screen. Check out this fiddle for a working example :)

.modal-dialog {
  width: 100%;
  max-width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
}

.modal-content {
  height: auto;
  min-height: 100%;
  border-radius: 0;
}
C.RaysOfTheSun
  • 706
  • 1
  • 6
  • 9