I would like to center my modal on the viewport (middle) I tried to add some css properties
.modal { position: fixed; top:50%; left:50%; }
I think this is a bit cleaner pure CSS solution than Rens de Nobel's solution. Also this does not prevent from closing the dialog by clicking outside of it.
http://plnkr.co/edit/JCGVZQ?p=preview
Just add some CSS class to DIV container with .modal-dialog class to gain higher specificity than the bootstraps CSS, e.g. .centered.
HTML
And make this .modal-dialog.centered container fixed and properly positioned.
CSS
.modal .modal-dialog.centered {
position: fixed;
bottom: 50%;
right: 50%;
transform: translate(50%, 50%);
}
Or even simpler using flexbox.
CSS
.modal {
display: flex;
align-items: center;
justify-content: center;
}