Class naming 101: BEM
Blog post from Webflow
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.