M
M
mishapsv2016-05-13 12:43:30
css
mishapsv, 2016-05-13 12:43:30

How to use double ampersand in SCSS for BEM?

I used Less before
and if I needed to apply a modifier for a block, I
<div class="block block--red"></div>
wrote

.block {
border: 1px solid black;
color: black;
  &&--red {
    color: red;
}
}

and get styles for .block.block--red
Googled the theme but couldn't find one for scss.
How do you make modifiers with sass?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Egor Tregubenko, 2016-05-13
@Sinecuraweb

1) block block--red is there a cascade in the beam?
2) one &
3) if you had such a class "block_block--red"
.block {
border: 1px solid black;
color: black;
&_block {
border:1px solid green;
&--red{
color:red; //Here are the styles for the required block
}
}
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question