css实现弹出窗体始终垂直水平居中

<!DOCTYPE html><html>
<head>
<meta charset=" utf-8">
<meta name="author" content="http://www.softwhy.com/" />
<title>蚂蚁部落</title>
<style type="text/css">
body{
  height:1000px;
}
.antzoen{
  position:fixed;
  250px;
  height:100px;
  background:#ececec;
  left:50%;
  top:50%;
  margin-left:-125px;
  margin-top:-50px
}
</style>
</head>
<body>
<div class="antzoen"></div>
</body>
</html>


可是这样的方法ie6不支持fixed属性。可是如今大多不再考虑ie6。

所以尽能够放心使用。

原文地址:https://www.cnblogs.com/jhcelue/p/6846959.html