zoukankan      html  css  js  c++  java
  • ie6下padding bug

    今晚发现ie6下原来还有一个bug,看代码:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title></title>
    <style type="text/css">
        *{ margin:0; padding:0;}
        #layout{ padding-top:10px;}
        #layout .test1,#layout .test2{ height:20px; border:1px solid #ccc;}
        #layout .test1{ float:left;}
        #layout .test2{ clear:both;}
    </style>
    </head>
    <body>
        <div id="layout">
            <div class="test1">test1</div>
            <div class="test2">test2</div>
        </div>
    </body>
    </html>
    
    这样,在IE6下,浮动层后的层也有padding-top,谷歌了下,说是什么3像素引起的,我原来自己的解决方案是在test2这个div里加个margin-top:-10px;这样解决,但发现可以通过给#layout这div一个zoom:1激活haslayout,从而解决问题。标记以记之。

  • 相关阅读:
    2020/7/18 JDBC
    2020.8.1
    2020.7.31
    二元泰勒公式
    一元泰勒公式
    极值
    介值定理
    积分上限函数
    积分中值定理
    狄利克雷(Dirichlet)函数
  • 原文地址:https://www.cnblogs.com/littledu/p/2034132.html
Copyright © 2011-2022 走看看