1Vertically centered
2Add .modal-dialog-centered to .modal-dialog to vertically center the modal.
3
4<!-- Button trigger modal -->
5<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#exampleModalCenter">
6 Launch demo modal
7</button>
8
9<!-- Modal -->
10<div class="modal fade" id="exampleModalCenter" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
11 <div class="modal-dialog modal-dialog-centered" role="document">
12 <div class="modal-content">
13 <div class="modal-header">
14 <h5 class="modal-title" id="exampleModalCenterTitle">Modal title</h5>
15 <button type="button" class="close" data-dismiss="modal" aria-label="Close">
16 <span aria-hidden="true">×</span>
17 </button>
18 </div>
19 <div class="modal-body">
20 ...
21 </div>
22 <div class="modal-footer">
23 <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
24 <button type="button" class="btn btn-primary">Save changes</button>
25 </div>
26 </div>
27 </div>
28</div>
1.yourElement{
2 position: relative;
3 top: 50%;
4 transform: translateY(-50%);
5}
6