1<!-- Button trigger modal -->
2<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#exampleModalCenter">
3 Launch demo modal
4</button>
5
6<!-- Modal -->
7<div class="modal fade" id="exampleModalCenter" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
8 <div class="modal-dialog modal-dialog-centered" role="document">
9 <div class="modal-content">
10 <div class="modal-header">
11 <h5 class="modal-title" id="exampleModalCenterTitle">Modal title</h5>
12 <button type="button" class="close" data-dismiss="modal" aria-label="Close">
13 <span aria-hidden="true">×</span>
14 </button>
15 </div>
16 <div class="modal-body">
17 ...
18 </div>
19 <div class="modal-footer">
20 <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
21 <button type="button" class="btn btn-primary">Save changes</button>
22 </div>
23 </div>
24 </div>
25</div>
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>