下面样式设置到父div上:
.modal { display: flex; align-items: center; /*竖直居中 垂直居中*/ justify-content: center; /*水平居中*/ }