S
S
Sergiu Mitu2017-06-20 12:11:28
css
Sergiu Mitu, 2017-06-20 12:11:28

How do you set css rules for an element whose parent has a class?

I have this code:

.some-class-wrap {
  .some-class {
    .link {
      margin: 100px;
    }
  }
}

how to make if .some-class has class .active, .link set margin: 0; ?
now i do:
.some-class-wrap {
  .some-class {
    .link {
      margin: 100px;
    }
    //так
    &.active {
      .link {
        
      }
    }
    //или так
    &.active .link {
      
    }
  }
}

but somehow this is inconvenient, I would like styles for .link to be set inside and not outside ..
how do you do it?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question