绝对定位元素的居中

方法一
.element { 600px; height: 400px; position: absolute; left: 0; top: 0; right: 0; bottom: 0; margin: auto; /* 有了这个就自动居中了 */ }

方法二
.element{
   100px;
  position: absolute;
  left: 50%;
  margin-left: -50px;
}
2个方法都需要有个宽度
原文地址:https://www.cnblogs.com/wz0107/p/4634258.html