Alexander Lomia Alexander Lomia - 4 years ago 121
Sass (Sass) Question

BEM - applying contextual styles to the block inside another block

Suppose we have


<div class="container">
<!-- some html -->
<a class="button">A Marvelous button</a>

How should we approach styling of the
block exclusively in
's context? Should we still create a

Answer Source

In this case if the button will be (re)used elsewhere, within different sections then I would say style it .button--modifier. Check out the atomic design pattern (, in this case a button would be an atom and the container likely a molecule. I think it is a good idea to style all reusable atoms in a .atom--modifier way but it would be good to hear other's views on this

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download