方法1:反向移动
- position:absolute;
- top:50%;
- left: 50%;
- -webkit-transform: translate(-50%, -50%);
- transform: translate(-50%, -50%);
方法2:flex布局
- display: flex;
- align-items: center;
- justify-content: center;
方法3:四向定位
- position: absolute;
- right: 0;
- left: 0;
- top: 0;
- bottom: 0;
- margin: