🍋
Menu
Comparison Beginner 1 min read 227 words

CSS Architecture: BEM, SMACSS, and ITCSS Compared

Large CSS codebases become unmaintainable without architecture. Compare the three most popular CSS methodologies and learn which suits your project.

Why CSS Architecture Matters

CSS has no built-in scoping or encapsulation. Every rule is global, and specificity conflicts grow exponentially with codebase size. CSS architecture methodologies provide naming conventions and organizational patterns to maintain order.

BEM (Block Element Modifier)

BEM structures class names as .block__element--modifier. A card component becomes .card, its title becomes .card__title, and a highlighted variant becomes .card--featured. BEM's flat specificity (everything is a single class) eliminates specificity wars. The verbose naming is its main criticism, but it makes relationships between components explicit.

SMACSS (Scalable and Modular Architecture for CSS)

SMACSS categorizes CSS into five types: Base (reset/normalize), Layout (grid systems, page sections), Module (reusable components), State (is-active, is-hidden), and Theme (visual variations). This separation makes it clear where new styles should go and where to look for existing ones.

ITCSS (Inverted Triangle CSS)

ITCSS organizes styles from generic to specific, creating an inverted triangle of specificity. Layers from broadest to narrowest: Settings, Tools, Generic, Elements, Objects, Components, Utilities. Each layer has higher specificity than the last, eliminating specificity conflicts by design.

Choosing the Right Architecture

BEM is the simplest to adopt and works well for component-based projects. SMACSS suits content-heavy sites with distinct page types. ITCSS provides the most rigorous organization for large teams. In practice, many teams combine elements — using BEM naming within an ITCSS layer structure.

Outils associés

Formats associés

Guides associés