How to vertically center modal?

There is a specific bootstrap class (v4.1) for this:

Add .modal-dialog-centered to .modal-dialog to vertically center the modal.

Source: https://getbootstrap.com/docs/4.1/components/modal/#vertically-centered


Not tested but you can try this

.yourElement{
  position: relative;
  top: 50%;
  transform: translateY(-50%);
}

As it looks as a bootstrap modal, Checkout this Fiddle (jsFiddle).

Try

.modal-dialog {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) !important;
}

Hope this helps!