Css SASS:带有组合&;的表达式:非选择器
我正在试图理解此SASS代码将生成什么:Css SASS:带有组合&;的表达式:非选择器,css,sass,Css,Sass,我正在试图理解此SASS代码将生成什么: &--active, &:not(&--disabled):not(&--inactive):hover, &:not(&--disabled):not(&--inactive):focus { background-color: white; color: grey; } 我想知道这部分: &:not(&--disabled):not(&--inactive)
&--active, &:not(&--disabled):not(&--inactive):hover, &:not(&--disabled):not(&--inactive):focus {
background-color: white;
color: grey;
}
我想知道这部分:
&:not(&--disabled):not(&--inactive):hover
表达式的第一部分对我来说很清楚&:not(&--disabled)
这将排除类
&--disabled
在应用下面编写的样式时但是它旁边的SCS是什么意思-
:不(&--inactive):悬停
?这些&:不是组合使用的
选择器吗?
此外,这个SCS有一些奇怪的行为——在本地主机上这不起作用——根本不适用,当它部署在测试服务器上时,它得到了应用,并且工作正常(它通过gulp插件进行编译和缩小)。
任何帮助和建议都将不胜感激。为什么不编译它,然后对输出进行解释 将以下内容付诸实施 (
.parent
只是使用&
父选择器所需的父规则)
看哪:
.parent--active,
.parent:not(.parent--disabled):not(.parent--inactive):hover,
.parent:not(.parent--disabled):not(.parent--inactive):focus {
background-color: white;
color: grey;
}
因此,有了输出,我们回到手头的事情 &:不(&--disabled):不(&--inactive):悬停 是 因此 任何
.parent
没有.parent--disabled
和.parent--inactive
类的.parent
类将在上显示白色背景和灰色:悬停
(.parent
只是一个例子-可能是div
,#foo
,…)谢谢,解释得非常清楚!你怎么想-为什么这个css没有在本地主机上应用-我的意思是,这部分根本没有得到遵守和应用。只有这一部分。但当它部署在测试服务器上时,就可以了?非常奇怪。@Julsy没有一个例子,我不可能回答下面的问题
.parent--active,
.parent:not(.parent--disabled):not(.parent--inactive):hover,
.parent:not(.parent--disabled):not(.parent--inactive):focus {
background-color: white;
color: grey;
}
.parent:not(.parent--disabled):not(.parent--inactive):hover