sass - 有没有办法在没有变量的情况下在 sass 中获得祖父母的名字?
问题描述
带变量
.comment {
$hah: ".comment";
&__item {
&:hover #{$hah}__right > #{$hah}__bottom {
height: 3rem;
}
}
}
我可以在没有变量的情况下获得祖父母的名字吗?
.comment { this this
&__item { vv vv
&:hover .comment__right > .comment__bottom {
height: 3rem;
}
}
}
所以我不必在里面再写 .comment 类
解决方案
SASS 中没有祖父选择器,但是,如果您不想.comment
再次编写选择器,可以将 & 符号存储在变量中:
.comment {
$hah: &;
&__item {
&:hover #{$hah}__right > #{$hah}__bottom {
height: 3rem;
}
}
}
这是一篇关于这个的好文章。
推荐阅读
- apache-storm - 从 Apache Storm Bolt 的一个元组中生成的元组数量是否有上限?
- java - 这两个用于检查字符串中是否有数字的语句有什么区别?
- selenium - 如何通过 Python 使用 Selenium 单击动态“喜欢”按钮?
- documentation - 数据集成项目必须记录的要点是什么?
- c# - 有没有办法根据触摸计数来管理对象移动切换?
- java - 使用正则表达式从日期格式字符串中删除元素
- javascript - vue.js 中谁是孩子,谁是父母
- python - 尝试使用openGL从2d点击屏幕获取3d点
- keras - 使用 TensorFlow 之类的 Keras 进行 gpu 计算
- apache-spark - 数据列 inputCol 尚未分析,无法在此数据帧上运行 TF