D
D
Dubrovin2018-08-16 17:17:24
Sass
Dubrovin, 2018-08-16 17:17:24

How to nest a tag inside a class in SCSS?

Hello,
there is a body tag with the class myclass for which you need to write styles. Scss can be written like this:

body {
    &.myclass {
        //здесь стили
    }
}

Is there any way to write it the other way around? those. nest not myclass inside body, but nest body inside myclass?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dubrovin, 2018-08-16
@Dubrovin

Hang on, found a solution:

.myclass {
    @at-root body#{&} {
        //стили
    }
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question