This is a two part question:
How can you position the modal vertically in the center when you don\'t know the exact height of the modal?
Is
I know it's a bit late, but I am adding a new answer so that it doesn't get lost in the crowd. It's a cross-desktop-mobile-browser solution that works everywhere properly as it should.
It just needs the modal-dialog
to be wrapped inside a modal-dialog-wrap
class and need to have the following code additions:
.modal-dialog-wrap {
display: table;
table-layout: fixed;
width: 100%;
height: 100%;
}
.modal-dialog {
display: table-cell;
vertical-align: middle;
text-align: center;
}
.modal-content {
display: inline-block;
text-align: left;
}
The dialog starts centered and in cases of large content it simply grows vertically until a scrollbar appears.
Here is a working fiddle for your pleasure!
https://jsfiddle.net/v6u82mvu/1/