Y
Y
yarovikov2020-12-23 09:32:10
Sass
yarovikov, 2020-12-23 09:32:10

How to change the styles of a nested element with an additional container class (BEM)?

Hi all. Something is broken in my google.

.grid {
  
  &__item {
    
  }
  
  // класс контейнера
  &_visible {
    
    // как правильно сделать, не используя конструкцию .grid__item ниже?
    &__item { // само собой, это не работает
    
    }
    
  }
  
}

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Anton, 2020-12-23
@weart

1) &_visible &__item {
2)
https://jsfiddle.net/qegfbxwr/3/

&_visible &{    
    &__item{ 
      color:#0f0;
    }
    
  }

T
Toasts, 2017-02-09
@Mike_Ro

An easier example

var variable = 1;

var prev;
function check(value) {
  var f = value == prev;
  prev = value;
  return f;
}

setInterval(function() {
  variable = Math.random() > 0.5 ? 1 : 0;
}, 2500);

setInterval(function() {
  console.log(prev, variable, prev == variable)
  console.log('check', check(variable))
}, 5000);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question