Home / Companies / Webflow / Blog / Post Details
Content Deep Dive

Class naming 101: BEM

Blog post from Webflow

Post Details
Company
Date Published
Author
Micah Ryan
Word Count
503
Language
English
Hacker News Points
-
Summary

Webflow's Cross-project copy/paste feature has delighted designers by enhancing modularity and emphasizing the importance of a structured naming convention for elements, which is crucial to maintaining clean and manageable CSS. The BEM (Block, Element, Modifier) naming convention is recommended for organizing user interfaces into small, reusable components, facilitating ease of reuse and adaptation across projects. BEM divides UI components into blocks, elements, and modifiers, where blocks represent high-level standalone elements, elements are subcomponents within blocks, and modifiers adjust elements or blocks for specific use cases. The convention simplifies the design process by mirroring familiar organizational structures, such as body parts, and suggests naming blocks with a "c-" namespace to denote components, ensuring clarity and global consistency in CSS classes.