How can I organize the BEM styles in my Webflow site without needing to create combo classes and adjust properties in a specific order?

TL;DR
  • Use BEM methodology in Webflow by creating separate classes for blocks, elements, and modifiers instead of combo classes.
  • Define block-level styles for consistency, element styles to maintain structure, and modifier styles for specific adjustments.
  • This method ensures consistent styling, simplifies maintenance, and enhances scalability.

Organizing BEM styles in Webflow can improve your workflow and make styles easier to manage without relying on combo classes. Here's how you can effectively implement BEM:

1. Understand BEM Methodology 

  • Block: Represents a standalone entity (e.g., button).
  • Element: A part of a block and has no standalone meaning (e.g., button__icon).
  • Modifier: A flag that changes the style or behavior (e.g., button--primary).

2. Setting Up Styles in Webflow

  • Create Separate Classes: Use distinct classes for each BEM element instead of creating combo classes.
  • Example: For a button with an icon, create separate styles for buttonbutton__icon, and button--primary.

3. Apply Styles in Webflow

  • Global Styles: Set base styles on the block level (e.g., button) to ensure consistency.
  • Element Styles: Define styles for elements (e.g., button__icon) within the block to maintain structure.
  • Modifier Styles: Use additional classes for modifiers (e.g., button--primary) to apply specific adjustments.

4. Benefits of BEM in Webflow

  • Consistency: Ensures a consistent approach to styling across the site.
  • Maintainability: Makes it easier to update and manage styles without affecting other elements.
  • Scalability: Facilitates adding new styles or features as the site grows.

Summary

Implementing BEM in Webflow involves defining separate classes for blocks, elements, and modifiers. This approach avoids the need for combo classes and keeps your CSS organized, consistent, and easy to manage.

Rate this answer

Other Webflow Questions