0

I have bootstrap modal when fire the modal it show on top center of page even when scroll page content down I can't see the modal dialog because its on top of page how can center it on screen.

.modal{position:fixed;top:0;right:0;bottom:0;left:0;z- index:1050;display:none;overflow:hidden;outline:0}
Amr Melegy
  • 11
  • 3

2 Answers2

1

Update your HTML with the following code

.modal
 .modal-dialog.modal-dialog-centered

Or remove this style from modal element

{position:fixed;top:0;right:0;bottom:0;left:0;z- index:1050;display:none;overflow:hidden;outline:0}

And update your CSS with the following code

.modal-dialog {
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
  }
Abdelrahman Hatem
  • 1,028
  • 1
  • 9
  • 20
0

I usually display a container div with grid, and place my modal in it:

.containerDiv {
    display: grid;
    width: 100vw;
    height: 100vh;
    place-items: center;
    background: transparent;

}
Pedro Henrique
  • 181
  • 3
  • 11