+ -
当前位置:首页 → 问答吧 → IE6\7下的margin问题

IE6\7下的margin问题

时间:2011-09-16

来源:互联网

废话不说,有以下的HTML+CSS代码,在IE8\FF\CHROME下都是正常的显示,在IE6\7下会出现重叠现象,希望有朋友能告知原因并给出解决方案:


HTML code

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
    <head>
        <title>阿里题1</title>
        <meta http-equiv="Content-type" content="text/html; charset=UTF-8">
        <style type="text/css">
          #container{
              position:relative;
              margin: 200px auto;
            width:300px;
            height:300px;
          }
            
            .hoverEnlarge {
                background: #CDD8DA;
            }
            
            .leftTopColumn {
                position: absolute;
            /*    left: 0;
                top: 0;*/
                width: 90px;
                height: 150px;
                z-index: 999;
                
            }
            
            .leftBottomColumn {
                position: absolute;
                width: 90px;
                height: 115px;
                margin-top: 157px;
                z-index: 998;
            }
            
            .rightColumn {
                /*position:absolute;
                left: 97px;*/
                margin-left:97px;
                width: 215px;
                height: 270px;
            }
        </style>
    </head>
    <body>
        <div id="container">
            <div class="leftTopColumn hoverEnlarge"></div>
            <div class="leftBottomColumn hoverEnlarge"></div>
            <div class="rightColumn hoverEnlarge"></div>
        </div>
    </body>
</html>




想实现一个整体两列, 左列又分上下两栏的布局。

作者: dxx1988   发布时间: 2011-09-16

`````````````````````````````````

作者: dxx1988   发布时间: 2011-09-16

靠, 知道原因拉。。。 #container{
  position:relative;
  margin: 200px auto;
  width:300px;
  height:300px;
  }


margin:200px auto; 这句去掉就可以了= =~~!!!

作者: dxx1988   发布时间: 2011-09-16

= =~~~ 哎哟, 昏头了。。 去掉也是不行的。。。

作者: dxx1988   发布时间: 2011-09-16

HTML code

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
    <head>
        <title>阿里题1</title>
        <meta http-equiv="Content-type" content="text/html; charset=UTF-8">
        <style type="text/css">
          #container{
            margin: 200px auto;
            width:300px;
            height:300px;
          }
            
            .hoverEnlarge {
                background: #CDD8DA;
            }
            
            .leftTopColumn {
                position: absolute;
                width: 90px;
                height: 150px;
                z-index: 999;
                
            }
            
            .leftBottomColumn {
                position: absolute;
                width: 90px;
                height: 115px;
                margin-top: 157px;
                z-index: 998;
            }
            
            .rightColumn {
                position:absolute;
                margin-left:97px;
                width: 215px;
                height: 270px;
            }
        </style>
    </head>
    <body>
        <div id="container">
            <div class="leftTopColumn hoverEnlarge"></div>
            <div class="leftBottomColumn hoverEnlarge"></div>
            <div class="rightColumn hoverEnlarge"></div>
        </div>
    </body>
</html>


作者: jiancm2001   发布时间: 2011-09-16