【发布时间】:2019-04-24 18:25:22
【问题描述】:
在 SCSS 中,我使用 @extend 将 2 个选择器合并到 1 行中,但伪选择器 (:before) 是在 #bar 内部创建的,如下所示:
#foo {
position: relative;
&:before {
width: 200px;
}
}
#bar {
@extend #foo;
}
输出:
#foo, #bar {
position: relative;
}
#foo:before, #bar:before {
width: 200px;
}
我想用 SCSS 做这样的:
#foo, #bar {
position: relative;
}
#foo:before {
width: 200px;
}
/* I want to remove #bar:before */
有没有办法通过创建@extend 来删除不需要的伪选择器?
【问题讨论】:
标签: css sass nested selector extend