:: after vs:在SUSY 2.0中的伪元素之后

时间:2014-03-19 19:53:51

标签: susy-compass susy-sass

在SUSY v1.x中,写作:

.content {
  @include container;
}

编译为

.content {
  max-width: 100%;
  margin-left: auto;
  margin-right: auto;
}
.content:after {
  content: " ";
  display: block;
  clear: both; 
}

现在,在SUSY 2.0中,它编译为

.content {
  max-width: 100%;
  margin-left: auto;
  margin-right: auto;
}
.content::after {
  content: " ";
  display: block;
  clear: both; 
}

问题是after伪元素中的两个冒号。单个冒号适用于所有浏览器,包括IE8 - 所以我想知道: 1)如果这是故意改变或疏忽,因为两个冒号掉落了对IE8的支持 2)如果有一个解决方法而没有写出IE8和#34;容器"的所有额外CSS。

2 个答案:

答案 0 :(得分:0)

根据标准,两个冒号“正确”,但我不知道IE8不支持它。请在GitHub上提交错误报告,或提交补丁,我会尽快恢复。

答案 1 :(得分:0)

我写这是IE8项目的解决方法。由于该浏览器即将推出,我认为这可能比根据当前标准重写您的代码更不可取。也许只是将IE8的变通方法添加到文档中?

$susy: (
    use-custom: (
        clearfix: true,
    )
);
// define custom clearfix because default uses ::after which doesn't work in IE8
@mixin clearfix() {
    &:after {
        content: " ";
        display: block;
        clear: both;
    }
}
相关问题