M
M
Max2019-07-29 22:40:35
Sass
Max, 2019-07-29 22:40:35

How to refer to a selector without specifying the name of the parent?

Good afternoon.
The selector &--active &__show doesn't work :(

.filters {
    &--active .filters__show {
      display: none;
    }
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Prisyazhnyuk, 2019-07-29
@kopcapuk

Read about interpolation in Sass

.filters {
    $root: &;

    &--active #{$root}__show {
      display: none;
    }
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question