使用text-align:center;和margin:0 auto;结果网页稍微居中;左边小于右边的空白。全选后发现,网页最外层div右边有一个30px左右的padding,好像是,选中时蓝色。我明明设了div,body等的margin padding border全是0的?

解决方案 »

  1.   

    margin-left:auto;
    margin-right:auto;
      

  2.   

    实在没办法就这样
    <center>
    ....网页标签
    </center>
      

  3.   

    var windowWidth = document.documentElement.clientWidth;
    var windowHeight = document.documentElement.clientHeight;
    var popupHeight = $("#popupContact").height();
    var popupWidth = $("#popupContact").width();
    //centering
    $("#popupContact").css({
        "position": "absolute",
        "top": windowHeight/2-popupHeight/2,
        "left": windowWidth/2-popupWidth/2
    });
      

  4.   

    加一个 *{padding:0px;margin:0px;}试一下?
      

  5.   

    应该和浏览器的安全级别什么有关。
    用<center>网页代码</center>还蛮有用的。