【问题标题】:What clearfixes support what browsers? [duplicate]哪些 clearfixes 支持哪些浏览器? [复制]
【发布时间】:2016-04-30 18:17:44
【问题描述】:

所以那里有十亿个清除修复。有没有人有他们的浏览器支持的集合?

【问题讨论】:

    标签: css clearfix


    【解决方案1】:

    这里是最常用的总结。

    解决方案 1:老派方式

    .clear {
      clear: both;
    }
    

    方法2:溢出方式

    .container {
      overflow: hidden; /* can also be "auto" */
    }
    

    方法 3:“clearfix”类

    .clearfix:before,
    .clearfix:after {
      content: "";
      display: table;
    }
    
    .clearfix:after {
      clear: both;
    }
    
    .clearfix {
      zoom: 1; /* ie 6/7 */
    }
    

    如果你不需要支持任何低于 IE8 的东西

    .clearfix:after {
      content: "";
      display: table;
      clear: both;
    }
    

    方法 4:Future 包含浮点值

    .container {
      min-height: contain-floats;
    }
    

    源:http://www.sitepoint.com/clearing-floats-overview-different-clearfix-methods/

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2023-04-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-05-15
      • 2023-04-03
      相关资源
      最近更新 更多