DIV垂直水平都居中

<%@ page language="java" import="java.util.*" pageEncoding="GBK"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
    <title>操作信息跳转页面</title>
<style type="text/css">
   <!--
   html,body {height:100%; margin:0px; font-size:12px;}
   .mydiv {
   background-color: #FFCC66;
   border: 1px solid #f00;
   text-align: center;
   line-height: 40px;
   font-size: 12px;
   font-weight: bold;
   z-index:999;
   300px;
   height: 120px;
   left:50%;
   top:50%;
   margin-left:-150px!important;/*FF IE7 该值为本身宽的一半 */
   margin-top:-60px!important;/*FF IE7 该值为本身高的一半*/
   margin-top:0px;
   position:fixed!important;/* FF IE7*/
   position:absolute;/*IE6*/
   _top:       expression(eval(document.compatMode &&
              document.compatMode=='CSS1Compat') ?
              documentElement.scrollTop + (document.documentElement.clientHeight-
  
   this.offsetHeight)/2 :/*IE6*/
              document.body.scrollTop + (document.body.clientHeight -
  
   this.clientHeight)/2);/*IE5 IE5.5*/
  
   }
  
   .bg,.popIframe {
   background-color: #666; display:none;
   100%;
   height: 100%;
   left:0;
   top:0;/*FF IE7*/
   filter:alpha(opacity=50);/*IE*/
   opacity:0.5;/*FF*/
   z-index:1;
   position:fixed!important;/*FF IE7*/
   position:absolute;/*IE6*/
   _top:       expression(eval(document.compatMode &&
              document.compatMode=='CSS1Compat') ?
              documentElement.scrollTop + (document.documentElement.clientHeight-
  
   this.offsetHeight)/2 :/*IE6*/
              document.body.scrollTop + (document.body.clientHeight - this.clientHeight)/2);
   }
   .popIframe {
   filter:alpha(opacity=0);/*IE*/
   opacity:0;/*FF*/
   }
   -->
</style>
<script type="text/javascript">
   var mills = 5;
   var times;
   window.onload = function(){
    //alert(0);
    times = setInterval("display()",1000);
   }
   function display(){
    mills -- ;
    document.getElementById("two").innerText = mills;
    if(mills == 0){
     clearInterval(times);
     window.location.href = "communicateMain.do";
    }
   }
</script>
</head>

<body>
    <div id="one" class="mydiv">
    <div><%=request.getAttribute("information") %></div>
    <div>
       <a href="communicateMain.do"><span id="two">5</span>秒钟后自动跳转</a>
    </div>
    </div>
</body>
</html>
原文地址:https://www.cnblogs.com/xinzhuangzi/p/4100515.html