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

Block

Standalone entity that is meaningful on its own.

Examples: header, container, menu, checkbox, input

Element

A part of a block that has no standalone meaning and is semantically tied to its block.

Examples: menu itemlist itemcheckbox captionheader title

Modifier

A flag on a block or element. Use them to change appearance or behavior.

Examples: disabledhighlightedcheckedfixedsize bigcolor yellow

Here’s an example:

See the Pen BEM 101 by Divya (@DivyaPatel) on CodePen.

Benefits

Modularity: Block styles are never dependent on other elements on a page, so you will never experience problems from cascading.

Reusability: Composing independent blocks in different ways, and reusing them intelligently, reduces the amount of CSS code that you will have to maintain.

Structure: BEM methodology gives your CSS code a solid structure that remains simple and easy to understand.

Words from our clients

 

Tell Us About Your Project

We’ve done lot’s of work, Let’s Check some from here