Order
Who wins when multiple rules target the same element?
Architecture field guide · 2026
Modern CSS architecture is a set of coordinated decisions: how styles are ordered, scoped, authored, tokenized, composed, and delivered. BEM still solves component identity. It no longer needs to solve everything.
First principle
Several approaches called “CSS alternatives” solve different layers of the problem. CUBE and ITCSS organize CSS. CSS Modules and Shadow DOM scope it. Tailwind and atomic compilers change the authoring and output model.
Who wins when multiple rules target the same element?
How far can a selector reach, and what can override it?
Do styles live in CSS, markup, JavaScript, or a typed compiler API?
How are tokens, variants, layouts, and component contracts governed?
Decision navigator
The best CSS architecture is constrained by distribution, build tooling, team scale, and the amount of enforcement the platform must provide.
Choose a context
Recommended system
It preserves transparent HTML and CSS, needs no compiler, survives copy-and-share workflows, and still provides explicit cascade control and responsive component behavior.
Pattern landscape
Ratings are architectural judgments, not performance benchmarks. Use the filters to narrow the landscape by responsibility.
Architecture substrate
Uses browser-native cascade layers, variables, selectors, queries, and scoping instead of a styling framework.
Best fitCustom sites, SPAs, documentation, and portable artifacts.
Methodology
Lets global CSS and composition do most of the work before adding utilities, blocks, and explicit exceptions.
Best fitCustom, content-rich, responsive interfaces.
Macro architecture
Orders CSS from broad, low-specificity rules toward narrow components and high-impact utilities.
Best fitLarge global CSS systems and layered design-system foundations.
Naming contract
Retains semantic block and element ownership while delegating state, layout, and cascade control to modern CSS.
Best fitSemantic component ownership across mixed delivery environments.
Build-time scoping
Converts local class names into generated mappings, preventing ordinary cross-component class collisions.
Best fitReact and framework products wanting conventional CSS plus isolation.
Framework scoping
Framework compilers colocate styles and transform selectors so they apply primarily to a component’s rendered subtree.
Best fitVue or Svelte applications fully owned by one framework.
Native hard boundary
Creates a native DOM and CSS boundary, with deliberate customization through custom properties and exposed shadow parts.
Best fitWidgets and web components embedded in external or unknown hosts.
Utility-first authoring
Composes interfaces from constrained, single-purpose utility classes in markup and generates the required CSS from source usage.
Best fitFramework product teams optimizing for implementation speed and consistency.
Runtime authoring
Authors styles through JavaScript and can generate or insert CSS from props and runtime application state.
Best fitInterfaces with concrete runtime-driven styling requirements.
Static CSS-in-TypeScript
Uses TypeScript as a build-time stylesheet preprocessor and emits locally scoped static CSS.
Best fitTypeScript-first component libraries and enterprise design systems.
Static atomic compiler
Compiles colocated JavaScript style definitions into collision-resistant atomic CSS with constrained composition rules.
Best fitVery large React estates with centrally governed styling infrastructure.
Typed atomic system
Statically analyzes JavaScript and TypeScript to generate atomic utilities and typed component recipes.
Best fitTyped design systems needing recipes and atomic output without runtime CSS.
Design-system substrate
Represents reusable design decisions as foundation, semantic, and component-level values—usually through CSS custom properties at runtime.
Best fitEvery serious system—provided the token vocabulary remains small and semantic.
Variant API
Defines finite component options, defaults, and compound combinations as a typed public API.
Best fitButtons, badges, controls, and stable design-system primitives.
Design taxonomy
Organizes interface inventories into atoms, molecules, organisms, templates, and pages; it is not a cascade architecture.
Best fitPattern-library organization—not CSS class naming.
Clear the search or choose a broader category.
Comparison matrix
Higher enforcement usually requires more build coupling. Stronger isolation usually reduces the reach of global styling. Faster authoring often moves visual information closer to markup or code.
| Approach | Primary job | Build | Runtime CSS | Isolation | Enforcement | Portability | Lock-in |
|---|---|---|---|---|---|---|---|
| Native layered CSS | Cascade architecture | No | No | Low | ●●○○ | ●●●● | Very low |
| CUBE CSS | Responsibility model | No | No | Low | ●○○○ | ●●●● | Very low |
| BEM-light | Semantic naming | No | No | Convention | ●○○○ | ●●●● | Very low |
| CSS Modules | Local class scope | Yes | No | Medium | ●●●○ | ●●●○ | Low |
| Shadow DOM | Hard native boundary | Optional | Low | High | ●●●● | ●●●○ | Low |
| Tailwind CSS | Utility authoring | Usually | No | Convention | ●●●○ | ●●○○ | Medium |
| Runtime CSS-in-JS | Dynamic styling | Yes | Yes | Medium | ●●●○ | ●○○○ | High |
| Vanilla Extract | Typed static CSS | Yes | No | Medium | ●●●● | ●●○○ | Medium |
| StyleX | Atomic CSS at scale | Yes | No | Compiler | ●●●● | ●○○○ | High |
| Panda CSS | Typed atomic recipes | Yes | No | Compiler | ●●●● | ●○○○ | High |
| Token-first | Design decisions | Optional | No | N/A | ●●○○ | ●●●● | Very low |
Rating scale: one dot is low; four dots is high. “Isolation” describes selector or component boundaries, not application security.
Progressive enhancement
A modern architecture should not turn every new CSS feature into a hard dependency. Establish a durable baseline, enhance component behavior, and reserve experimental capabilities for optional polish.
@supports boundaries around nonessential enhancements@scope, relational selectors, and advanced transitions@supports (container-type: inline-size) {
.signal-card {
container: signal-card / inline-size;
}
@container signal-card (width >= 32rem) {
.signal-card__body {
grid-template-columns: minmax(0, 1fr) auto;
}
}
}
Recommended synthesis
The goal is not to select one ideology. It is to assign one clear responsibility to each layer.
Layers, custom properties, container queries, logical properties, selectors, and progressive enhancement.
Reset → vendor → tokens → base → layout → components → utilities → documented overrides.
Reusable stack, cluster, grid, sidebar, switcher, and full-bleed relationships.
Semantic block and element classes. No DOM mirroring. No location-based component names.
Native state first, then ARIA, data attributes, and only then static modifier classes.
@layer reset, vendor, tokens, base,
layout, components, utilities,
overrides;
@layer components {
.signal-card {
container: signal-card / inline-size;
--card-padding: var(--space-4);
padding: var(--card-padding);
}
.signal-card:where(
[data-density="compact"]
) {
--card-padding: var(--space-3);
}
@container signal-card (width >= 32rem) {
.signal-card__header {
grid-template-columns:
minmax(0, 1fr) auto;
}
}
}
Architecture decision record
This turns the explainer into an operating decision rather than a catalog of options.
New handcrafted CSS uses native cascade layers, semantic tokens, reusable layout compositions, BEM-light component ownership, attribute-driven state, and container-aware responsiveness.
Operating rules
Parents and composition primitives own external placement and spacing.
Prefer :disabled, aria-expanded, and data-state over generic state classes.
Use container queries for reusable components and media queries for application-shell decisions.
Use foundation → semantic → component-local tokens. Avoid tokenizing every literal value.
One class by default. Use :where() for conditions. Let layers control precedence.
Adopt a compiler for enforcement, scale, or typed APIs—not merely to avoid naming classes.
Red-team checklist
Context, state, viewport, and layout encoded as a growing list of --modifier classes.
Normal unlayered author rules outrank normal rules in named layers, bypassing the intended cascade contract.
Nesting can hide selector depth. It does not turn DOM-coupled selectors into a sound architecture.
Arbitrary one-off utilities recreate inline styles with a custom naming tax and weak semantic traceability.
Long aliases for every value create more indirection than design consistency.
A build-time styling system adds migration and debugging cost unless scale or enforcement pays it back.
Provenance
This artifact prioritizes specifications and official project documentation. The comparison and recommendations are a reasoned synthesis rather than a vendor benchmark.
Approaches were classified by the primary problem they solve. Each was assessed against build requirements, runtime styling cost, scope strength, enforcement, portability, lock-in, and best-fit delivery environment. Vendor claims were treated as descriptions of intended design, not independent performance evidence.
Evidence: S01, S02
Evidence: S03, S23, S24
Evidence: S04, S05, S18, S21
Evidence: S06, S08, S09, S10
Evidence: S07, S11–S15
Evidence: S16, S20, S22
Derived from C01, C02, C03, and C06
Architectural judgment informed by C04, C05, and C06
Evidence: S25, S26
Primary BEM documentation for block, element, and modifier naming and independence.
bem.info/en/methodology/naming-convention/Widely used double-hyphen modifier and double-underscore element naming dialect.
getbem.com/naming/@layerReference for declaring cascade layers and defining their precedence order.
developer.mozilla.org/.../@layerPrimary explanation of Composition, Utility, Block, and Exception and its progressive CSS philosophy.
cube.fyi/Primary documentation for skeletal layout compositions and data-attribute exceptions.
cube.fyi/compositioncube.fyi/exception.htmlDefines local class mappings and the local-to-global export model.
github.com/css-modules/css-modulesOfficial description of utility-class authoring, variants, and source-driven generation.
tailwindcss.com/docs/styling-with-utility-classesFramework documentation for scoped styles and CSS Modules in Vue single-file components.
vuejs.org/api/sfc-css-features.htmlNative encapsulation model for reusable web component internals.
developer.mozilla.org/.../Using_shadow_DOMReference for deliberately exposing selected shadow-tree elements through ::part().
Official runtime CSS-in-JS authoring model and framework integration overview.
emotion.sh/docs/introductionFramework guidance for CSS-in-JS compatibility with Server Components, style registries, and server insertion.
nextjs.org/docs/app/guides/css-in-jsOfficial description of type-safe local styles and static CSS generation at build time.
vanilla-extract.style/Official compiler model for local JavaScript authoring and optimized collision-free atomic CSS.
stylexjs.com/docs/learnOfficial overview of static analysis, typed styling primitives, and generated atomic CSS.
panda-css.com/docs/overview/getting-startedOfficial recipe and compound-variant model with ahead-of-time atomic class generation.
panda-css.com/docs/concepts/recipesOriginal taxonomy of base, layout, module, state, and theme rules.
smacss.com/book/categorizing/Concise documentation of the broad-to-specific layered architecture.
developer.helpscout.com/seed/glossary/itcss/Primary description of atoms, molecules, organisms, templates, and pages.
atomicdesign.bradfrost.com/chapter-2/Framework-independent custom-property library demonstrating reusable design-token scales.
open-props.style/Intrinsic, reusable layout composition patterns for robust responsive interfaces.
every-layout.dev/Vendor-neutral design-token specification milestone and cross-tool interoperability context.
w3.org/community/design-tokens/.../first-stable-version/Reference for styling components based on containing context rather than viewport alone.
developer.mozilla.org/.../Container_queries@scopeReference for limiting selector reach to a bounded DOM subtree.
developer.mozilla.org/.../@scopeOfficial WCAG 2.2 guidance for minimum luminance contrast of text and images of text.
w3.org/WAI/WCAG22/Understanding/contrast-minimumOfficial WCAG 2.2 guidance for essential interface components, states, and graphical objects.
w3.org/WAI/WCAG22/Understanding/non-text-contrast