Z
Z
ZaxapKramer2017-03-30 09:06:38
css
ZaxapKramer, 2017-03-30 09:06:38

BEM. Some inconsistencies on different sites, that's all the same, right?

I read one source - they write that it is correct to designate modifiers through underlining:
.my-block { }
.my-block_modifer { }
I read another source - here (and not only ) they write that it is necessary to put a double dash (two minuses, if you like):
.my-block { }
.my-block--modifer { }
Where, after all, is it true? As I understand it, BEM is something to strive for in order to improve readability, and yes, I agree with that. But how strict is BEM? If I want to denote modifiers with "--", should I do that, will it "still" be called BEM?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Goryachev, 2017-03-30
@ZaxapKramer

How to properly format a BEM block?
Edward gave a complete answer in my discussion.

Sergey Goryachev @webirus
Edward: And such a question, according to this documentation, the modifier is issued "--", but everywhere in other places "_", what's the catch?)

Edward @edalis
Sergey Goryachev: This is a slightly modified class naming system, in accordance with the suggestions of Nicholas Gallagher, for example, I also like it more than the original one. Here's to you for a few more days)))
frontender.info/MindBEMding
A good source of information is here https://nicothin.github.io/idiomatic-pre-CSS/
I personally like styling better with "--". It turns out more clearly.
.site-search{} /* Блок */
.site-search__field{} /* Элемент */
.site-search--full{} /* Модификатор */

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question