re: BEM - A CSS Naming Convention VIEW POST


Nice article! BEM-naming really makes a lot of sense and makes your code more understandable.

<li className="navList__item--blue">I am blue!</li>

One thing, though. I may be mistaken, but as far as I know according to BEM methodology you shouldn't use modifier alone (without block or element class). So it should be something like:

<li className="navList__item navList__item--blue">I am blue!</li>

You're not wrong, the modifier is just the -- at then end of the name though. I just used simple class names for the purpose of demonstration. The listItems are still elements, just elements with a modifier.

Code of Conduct Report abuse