元素的水平垂直居中 at: 2019-10-12
已知元素宽高margin负值 + 绝对定位优点:兼容性好。
缺点:需提前知道元素的尺寸,否则需借助JS获得。
.child {
width: 600px; height: 400px;
position: absolute; left: 50%; top: 50%;
margin-top: -200px; /* 高度的一..