如果 LESS 中存在特定的 class,则将变量设置为新值
Set variable to a new value if a specific class is present in LESS
用一个例子很容易解释我想要什么。
我想达到
.someClass {
@aVariable: 100px;
/*
if(along with .someClass .anotherClass is present) {
@aVariable = 200px;
}
*/
/*@aVariable is used here */
}
重点是根据另一个class存在设置@aVariable
。
我看到了 the 答案,但对我来说没有用。
.someClass {
@aVariable: 100px;
/*@aVariable should be used here */
&.anotherClass {
@aVariable: 200px;
/*2nd @aVariable should be used here. this will overide above css*/
}
}
用一个例子很容易解释我想要什么。
我想达到
.someClass {
@aVariable: 100px;
/*
if(along with .someClass .anotherClass is present) {
@aVariable = 200px;
}
*/
/*@aVariable is used here */
}
重点是根据另一个class存在设置@aVariable
。
我看到了 the 答案,但对我来说没有用。
.someClass {
@aVariable: 100px;
/*@aVariable should be used here */
&.anotherClass {
@aVariable: 200px;
/*2nd @aVariable should be used here. this will overide above css*/
}
}