<style type="text/css">
.cDiv {
position: absolute; /* 绝对定位 */
top: 50%; /* 距顶部 50% */
left: 50%; /* 距左边 50% */
height: 200px;
margin-top: -100px;
width: 400px;
margin-left: -100px;
}
</style>
<div class="cDiv">div 屏幕居中的方法</div>
参考原文修改出来的:https://fangwei.iteye.com/blog/442628