弹性盒布局,水平垂直居中(justify-content: center;align-items: center;)
justify-content 用于设置或检索弹性盒子元素在主轴(横轴)方向上的对齐方式。
https://www.runoob.com/cssref/css3-pr-justify-content.html?_t_t_t=0.9588430565985012
align-items 属性定义flex子项在flex容器的当前行的侧轴(纵轴)方向上的对齐方式。
https://www.runoob.com/cssref/css3-pr-align-items.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
.m-wrap{display: flex;position: absolute;top: 0;bottom: 0;left: 0;right: 0;justify-content: center;align-items: center;}
.m-dialog{background: red;width: 200px;height: 150px;}
</style>
</head>
<body>
<div class="m-wrap">
<div class="m-dialog"></div>
</div>
</body>
</html>