作为 SCSS 的新手,我想知道如何将它的嵌套用于 element + element CSS 选择器。通常,在 CSS 中,我会这样写:
.test{
color: red;
}
.test + label{
color: blue;
}
如何将 + label
选择器嵌套在 .test
选择器中?提前致谢!
最佳答案
更新:在这种情况下,您需要做的就是像这样嵌套规则:
.test {
color: red;
+ label {
color: blue;
}
}
但是,您也可以使用 &
选择器来实现相同的效果,如下所示:
.test {
color: red;
& +label {
color: blue;
}
}
关于css - SCSS中嵌套元素+元素选择器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38496294/