25
loading...
This website collects cookies to deliver better user experience
BEM is a highly useful, powerful, and simple naming convention that makes your front-end code easier to read and understand, easier to work with, easier to scale, more robust and explicit, and a lot more strict.
The BEM approach ensures that everyone who participates in the development of a website works with a single codebase and speaks the same language. Using BEM’s proper naming convention will better prepare you for design changes made to your website.
<div class="product">
<img src="product1.png" alt="Product1" />
<h3 class="product__name">Product1</h3>
<p class="product__price>$30.99</p>
<button class="product__btn product--color--blue>Blue</button>
<button class="product__btn product--color--red>Red</button>
<button class="product__btn product--color--black>Black</button>
</div>
BEM is only used with classnames. It can tedious when writing the classnames but they will be of great help at the end of the day.