gpt4 book ai didi

css - 在这种情况下有没有更好的方法来使用嵌套的 SASS 和选择器?

转载 作者:行者123 更新时间:2023-11-28 14:32:20 25 4
gpt4 key购买 nike

我需要选择一个元素的子元素,但它基于父元素的 :last-of-type。

我试过:

&:last-of-type {
&__content {
border-bottom: 0;
}
}

由于 SASS 的构造方式,这不起作用。

我最终得到了:

.assignment-selection {
&__list-item {
&__content {
border-bottom: 1px solid;
}
&:last-of-type {
.assignment-selection {
&__list-item {
&__content {
border-bottom: 0;
}
}
}
}
}
}

有没有更好/更有效的写法?

最佳答案

应该这样做

&:last-of-type > &__content {
border-bottom: 0;
}

关于css - 在这种情况下有没有更好的方法来使用嵌套的 SASS 和选择器?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54000323/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com