What are the BEM naming conventions in CSS?

November 30, 2020

The Block, Element, Modifier methodology (commonly referred to as BEM) is a popular naming convention for classes in HTML and CSS. Developed by the team at Yandex, its goal is to help developers better understand the relationship between the HTML and CSS in a given project.

Compare the same name for a CSS selector that is written in different ways :

Naming Rules :

Important: Elements of elements do not exist in the BEM methodology. The naming rules do not allow creating elements of elements, but you can nest elements inside each other in the DOM tree.

Source : Naming Convention / Methodology BEM