使设置了固定定位的盒子在父盒子内居中。
position: absolute;
top: 50%;
left: 50%;
margin-top: -(dom高度)/2px;
margin-left: -(dom宽度)/2px;
1、可以用flex justify-content:center;align-items:center
2、绝对定位居中
.parent{position: relative}
.son{position: absolute;top: 0;left: 0;bottom: 0;right: 0;margin: auto}
https://blog.csdn.net/weixin_44659458/article/details/118912533