0
只是一個關於SASS選擇器嵌套的問題,所以我在一個嵌套的範圍內,我想應用:hover
僞所以不透明度更改爲0,我也想使用這種風格,雖然當父標籤獲得類is-active
。現在我會將is-active
類移到範圍之外並重新應用樣式,但是我想知道是否可以像遍歷一樣在嵌套樣式中向上移動一個水平?是否有可能將嵌套SASS選擇器遍歷到父選擇器?
我的例子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;
}
}
}
}
這是如何保存任何東西?除非擴展類在別處被重用(OP從不意味着他們打算這麼做),否則這只是執行OP所需要的複雜方式。 – cimmanon