Alternative Naming Conventions: SMACSS and OOCSS
What you'll learn: Beyond BEM, there are other powerful CSS naming and organization methodologies that can help you write maintainable, scalable stylesheets.
The Landscape of CSS Methodologies
While BEM focuses on naming conventions, other methodologies take broader approaches to CSS architecture. Two influential alternatives are SMACSS (Scalable and Modular Architecture for CSS) and OOCSS (Object-Oriented CSS).
SMACSS: Organizing by Category
SMACSS organizes styles into five categories:
- Base: Default element styles (like resets)
- Layout: Major page sections (prefixed with
l-orlayout-) - Module: Reusable components (the bulk of your CSS)
- State: How things look when in a particular state (prefixed with
is-likeis-active) - Theme: Color schemes and visual variations
Think of SMACSS as organizing your closet by garment type (shirts, pants, accessories) rather than by outfit.
OOCSS: Separating Structure and Skin
OOCSS focuses on two principles:
- Separate structure from skin: Keep layout properties (width, height, margin) separate from visual properties (color, border, background)
- Separate container from content: A component should look the same no matter where you place it
For example, instead of .sidebar-button with all styles together, you'd use .button for visuals and a separate .ml-2 or layout class for positioning.
These methodologies can be mixed with BEM or used independently depending on your project's needs.
Key Takeaway: SMACSS organizes CSS by category and purpose (Base, Layout, Module, State, Theme), while OOCSS emphasizes reusable, context-independent components by separating structure from appearance—both offer alternatives to BEM's naming-focused approach.