I
I
Ilya Korotkov2021-12-18 19:22:58
Sass
Ilya Korotkov, 2021-12-18 19:22:58

SCSS use &?

Started using SCSS. Does the & operator work inside an element that is also defined by &?
The code:

a {
    &:nth-child(2) {
      margin-left: auto;
      background: none;
      border: none;

      &:hover {
        color:#1F8EFA;
      }
    }

The hover rule doesn't work.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey delphinpro, 2021-12-18
@delphinpro

Works. The output will be

a:nth-child(2) {
  margin-left: auto;
  background: none;
  border: none;
}
a:nth-child(2):hover {
  color:#1F8EFA;
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question