Elf M. Sternberg

Full Stack Web Developer

Where one teaches, two learn.

Tag: #shadowDOM

To all tags

BEM is Back, Baby!

BEM (Block, Element, Modifier), the CSS discipline in which CSS components are defined in ways that clarify how they're used, has long been lamented for its verbosity. Take this example from the home page banner on the BEM advocacy site GetBEM:

.opinions-box__view-more--is-disabled {
    color: gray;
}

This means that there's a high-level, class-based component, opinions-box, with a child element (a button, perhaps) with the class view-more, and this is the class you apply to that button when it's enabled.

These rule names can get absurdly long.

Personally, I find BEM to be about as unweildy as a Swiss Army Sword. It still insists that you memorize certain semantics and focus on how they interact with the rest of the world. We tried to tame the beast, but somehow, recently, it has once again gotten out of hand.