我正在尝试使用scss为specifity reasons生成一个double类,并避免使用可怕的!important
我尝试过以下示例:
.my-class {
color: black;
&.&:hover {
color: red;
}
}
但我得到的只是:
Error: Invalid CSS after "... of parent rule": expected "}", was "&.&:hover {"
答案 0 :(得分:2)
参考your answer,也可以插入&符号:
.my-class {
color: black;
&#{&}:hover {
color: red;
}
}
输出
.my-class {
color: black;
}
.my-class.my-class:hover {
color: red;
}