A
A
Alex Krynytskyi2020-12-24 19:44:35
Sass
Alex Krynytskyi, 2020-12-24 19:44:35

How to hover a parent element so that the child changes in SCSS?

How to write correctly so that the color of box-1 changes?
https://skr.sh/s5mQNSBqDlD

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
iBird Rose, 2020-12-24
@NEOmanceR

because & is already different. do like this:

&:hover {
    .main__box-1 {}
}

or save & to a variable
.main {
  $v: &;
  &:hover {
    #{$v}__box-1 {
      background: #000;
    }
  }
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question