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.
CSS 축소기
CSS 코드 축소로 파일 크기 절감
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.
관련 도구
관련 포맷
관련 가이드
CSS Units Explained: px, em, rem, vh, and When to Use Each
CSS offers over a dozen length units, each suited to different situations. Understanding the differences between absolute and relative units is essential for building responsive, accessible interfaces.
Flexbox vs CSS Grid: A Practical Comparison
Flexbox and CSS Grid are complementary layout systems, not competitors. This guide clarifies when to reach for each one and how to combine them for robust, responsive page layouts.
How to Create CSS Gradients: Linear, Radial, and Conic
CSS gradients create smooth color transitions without image files. Learn to build linear, radial, and conic gradients with precise control over color stops, direction, and shape.
Troubleshooting CSS Specificity Conflicts
When CSS rules unexpectedly override each other, specificity is usually the culprit. This guide explains how specificity is calculated and provides strategies for managing it in growing codebases.
CSS Custom Properties (Variables) Best Practices
CSS custom properties enable dynamic theming, design tokens, and maintainable style systems. Learn how to organize, scope, and use CSS variables effectively in production applications.