【发布时间】:2013-04-05 05:28:02
【问题描述】:
只是一个关于 SASS 选择器嵌套的问题,所以我在一个嵌套跨度内,我想将 :hover 伪应用到以便不透明度更改为 0,我也想使用这种样式虽然当父标签获取课程is-active。现在我会将is-active 类移到跨度之外并重新应用该样式,但我想知道您能否像遍历一样从嵌套样式中上移一个级别?
我的 SASS 示例:
.btn-lang {
// styles...
> span {
// styles...
&:hover { // i want to use this when btn-lang has class is-active
opacity: 0;
}
}
// right now I would add these styles here but seems there could be an easier method?
&.is-active {
> span {
&:hover {
opacity: 0;
}
}
}
}
【问题讨论】: