带变量
.comment {
$hah: ".comment";
&__item {
&:hover #{$hah}__right > #{$hah}__bottom {
height: 3rem;
}
}
}
我可以得到没有变量的祖 parent 姓名吗?
.comment { this this
&__item { vv vv
&:hover .comment__right > .comment__bottom {
height: 3rem;
}
}
}
所以我不必在其中再次编写.comment类
最佳答案
SASS中没有祖 parent 选择器,但是,如果您不想再次编写.comment
选择器,可以将&符号存储在变量中:
.comment {
$hah: &;
&__item {
&:hover #{$hah}__right > #{$hah}__bottom {
height: 3rem;
}
}
}
这是一个nice article关于这个。
关于sass - 有没有办法在没有变量的情况下在 sass 中获取祖 parent 姓名?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55448369/