方法一:已知宽高 div{ position: absolute; left: 0; right: 0; bottom: 0; top: 0; margin: auto; } 方法二:未知宽高 div{ position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%); }