Nesting element+element selector in SCSS

后端 未结 1 1560
忘了有多久
忘了有多久 2021-01-24 08:47

As a newbie in SCSS I am wondering how to use its nesting for the element + element selector of CSS. Normally, in CSS, I would write something like:

.te         


        
相关标签:
1条回答
  • 2021-01-24 09:01

    Upate: In this case all you need to do is to nest rules like this:

    .test {
        color: red;
        + label {
            color: blue;
        }
    }
    

    However, you can also use the & selector to achieve the same effect like this:

    .test {
        color: red;
        & +label {
            color: blue;
        }
    }
    
    0 讨论(0)
提交回复
热议问题