3 ms·
BEM is extremely verbose: <div class="block block__element block__element--modifier"></div> Is there some good reason people write that instead of just the
by romaniv 10y ago
BEM is extremely verbose:
<div class="block block__element block__element--modifier"></div>
Is there some good reason people write that instead of just the following?
<div block="element modifier"></div>
Unless I'm missing something, with the second approach you get the same specificity, higher flexibility and shorter and more readable markup. Moreover, you end up using selectors the way they're intended to use.
- RobertKerans 10y agoIt's supposed to be extremely verbose, and extremely explicit, and create single-responsibility classes as much as is possible. It makes it explicit what is being modified. It's not very nice to write, but on balance, it works well.
- benologist 10y agoInitially I thought the verbosity mattered but there was gains to be made restructuring my CSS too and it forced me to fill in some knowledge gaps so overall it was a big gain with a very small gain in bytes. I reached BEM via AirBNB's CSS style guide - to me the real value in these style guides is I don't have to care about formatting CSS, JS etc anymore. http://github.com/airbnb/css http://github.com/airbnb/css