#main{ position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%); } div的id为main,这样就可以居中了