我知道你可以使用&
:
.btn {
.btn-group & {
color: blue;
}
}
但是你能不能也说一下,如果父结点是btn-group,而。btn-group是第一个子结点?
类似:
.btn {
.btn-group & &:first-child {
color: blue;
}
}
我算出来我能做到:
.btn {
.btn-group:first-child & {
color: blue;
}
}
但是找不到有多个伪选择器的方法(除了使用上面用逗号分隔的语法):
// This doesn't work :(
.btn {
.btn-group & {
&:first-child,
&:last-child {
color: blue;
}
}
}