我有一个:not
SASS mixin 中的 css 选择器,但它不执行任何操作:
代码片段:
@mixin dropdown-pos($pos:right) {
&:not(.notip) {
@if $comp-tip == true{
@if $pos == right {
top:$dropdown-width * -0.6;
@include tip($pos:$pos);
}
}
}
&.notip {
@if $pos == right {
top: 0;
left:$dropdown-width * 0.8;
}
}
}
The .notip
正在生成类,但没有生成 CSS:not(.notip)
.
我尝试重新创建这个,并且.someclass.notip
正在为我生成但是.someclass:not(.notip)
不是,因为只要我没有@mixin tip()
定义的。一旦我有了这个,一切就都成功了。
http://sassmeister.com/gist/9775949 http://sassmeister.com/gist/9775949
$dropdown-width: 100px;
$comp-tip: true;
@mixin tip($pos:right) {
}
@mixin dropdown-pos($pos:right) {
&:not(.notip) {
@if $comp-tip == true{
@if $pos == right {
top:$dropdown-width * -0.6;
background-color: #f00;
@include tip($pos:$pos);
}
}
}
&.notip {
@if $pos == right {
top: 0;
left:$dropdown-width * 0.8;
background-color: #00f;
}
}
}
.someclass { @include dropdown-pos(); }
EDIT: http://sassmeister.com/ http://sassmeister.com/是调试 SASS 的好地方,因为它会向您提供错误消息。Undefined mixin 'tip'.
这是我删除时得到的@mixin tip($pos:right) { }
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)