Skip to content Skip to sidebar Skip to footer

How To Select One Step Bigger Parent In SCSS

I have already opened a question about this problem. But I think, I solved the problem. SCSS parent selector not works But here is another problem. When I write this Scss code: #pa

Solution 1:

It looks like your code is wrapped by a body-tag and a #parts-tag. This means you need to change your code to this:

#partThree{
    display: block;
}

&.two-parts #partThree {
    display: none;
}

The & takes EVERYTHING before the current line. So if your final SCSS is:

body {
    #parts {
        #partThree {
            display: block;

            .two-parts & {
                display: none;
            }
        }
    }
}

Then the & will add .two-parts before everything else, and make it:

.two-parts body #parts #partThree {
    display: none;
}

Post a Comment for "How To Select One Step Bigger Parent In SCSS"