我找不到解决方案。例如,我在LESS中有一种风格:
.any{
background: #fff;
a{
color: #faa;
}
}
.any.last{
background: #aaa;
}
.any.last a{
color: #fa0;
}
我想将这些样式收集到一个括号中? 在不同的语言中,可以使用“$ this”来完成。但是没有办法。 我想做这样的事情:
.any{
background: #fff;
a{
color: #faa;
}
this.last{
background: #aaa;
}
this.last a{
color: #fa0;
}
}
谢谢你!
答案 0 :(得分:5)
只需使用& :
.any {
background: #fff;
a {
color: #faa;
}
&.last {
background: #aaa;
}
&.last a {
color: #fa0;
}
}