Bootstrap class: .modal-dialog-centered

Do not have time to learn all the Bootstrap classes?

Try drag & drop Bootstrap builder

<!-- Button trigger modal -->
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#exampleModalCentered">
  Launch centered demo modal
</button>

<!-- Modal -->
<div class="modal" id="exampleModalCentered" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenteredLabel" aria-hidden="true">
  <div class="modal-dialog modal-dialog-centered" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title" id="exampleModalCenteredLabel">Modal title</h5>
        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </button>
      </div>
      <div class="modal-body">
        ...
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
        <button type="button" class="btn btn-primary">Save changes</button>
      </div>
    </div>
  </div>
</div>

Preview

Sass source

/* _modal.scss:53 */
.modal-dialog-centered {
  display: flex;
  align-items: center;
  min-height: calc(100% - (#{$modal-dialog-margin} * 2));

  // Ensure `modal-dialog-centered` extends the full height of the view (IE10/11)
  &::before {
    display: block; // IE10
    height: calc(100vh - (#{$modal-dialog-margin} * 2));
    content: "";
  }
}

/* _modal.scss:161 */
.modal-dialog-centered {
  min-height: calc(100% - (#{$modal-dialog-margin-y-sm-up} * 2));

  &::before {
    height: calc(100vh - (#{$modal-dialog-margin-y-sm-up} * 2));
  }

}

Uses variables

Code copied to the clipboard.

Copying failed

/* _modal.scss:53 */
$modal-dialog-margin}
$modal-dialog-margin}

/* _modal.scss:161 */
$modal-dialog-margin-y-sm-up}
$modal-dialog-margin-y-sm-up}

More in Bootstrap Modal