火狐ff下margintop太给力

今天做的一个项目,在火狐下测试发现了一点小瑕疵。最终锁定在margin-top在ff下的影响。

<doctype html>
<html>
     <head>
         #parent{ height:300px;background:.....}
         #children{margin-top:10px}
    </head>
     <body>
        <div id="parant">
              <div id="childeren"></div>
      </div>
    </body>
</html>

就是因为这个,我发现margin-top在ff应经失去作用,我想这还不简单,直接改padding-top不久行了吗。

但是parent有背景图。发现改成padding-top没用,怎么解决。决定试试其他的,经过种种测试,总如下。【其中部分是参考google的搜索结果的】

01.在parent上加 overflow:hidden;

02.在parent上加 clear:both(或者 clear:left);

03.在parent上加 border属性,不能使 none,0.只能是类似这个格式的 border:solid  npx #xxxxxx;

原文地址:https://www.cnblogs.com/NetSos/p/1961077.html