CSS + DIV 居中写法(不定宽高)
最新写法:CSS3,不兼容IE8-
position: fixed;
top: 50%;
left: 50%;
width: 50%;
max-width: 630px;
min-width: 320px;
height: auto;
z-index: 2000;
visibility: hidden;
-webkit-backface-visibility: hidden;
-moz-backface-visibility: hidden;
backface-visibility: hidden;
-webkit-transform: translateX(-50%) translateY(-50%);
-moz-transform: translateX(-50%) translateY(-50%);
-ms-transform: translateX(-50%) translateY(-50%);
transform: translateX(-50%) translateY(-50%);
CSS3 不定宽高水平垂直居中
justify-content:center;//子元素水平居中
align-items:center;//子元素垂直居中
display:-webkit-flex;