Answer the question
In order to leave comments, you need to log in
Have I understood the essence of class naming in BEM correctly?
I have a relatively large nesting of blocks in blocks and the classes are as follows: .news-grid
- news grid .news-grid__item
- news element .news-grid__item__more-btn
- "Read more" button in the news element .news-grid__item__more-btn__icon
- an icon with an arrow in this button.
And so the classes can grow even more. Is this normal or am I not understanding something?
Answer the question
In order to leave comments, you need to log in
Not quite right.
If you want the whole news grid to be one block, and not grid=block + news=block, then in your case it would be logical to use this:
.news-grid - news grid
.news-grid__item - news element (probably news element)
. news-grid__more-btn - the button "Read more" in the news element
.news-grid__btn-icon - the icon with an arrow in this button.
Block__Element--Modifier, not Block__Element__Element--Modifier)))
The name is BEM, not BEEEM...
Watch the video www.youtube.com/watch?v=kBgHdSOj33A - short and clear
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question