Order
Who wins when multiple rules target the same element?
Architecture field guide · Research refresh July 2026
The relevant decision is no longer “BEM or not BEM.” Modern architecture assigns separate mechanisms to cascade order, selector reach, component identity, layout composition, design tokens, runtime state, and build-time enforcement.
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?
Research refresh · July 2026
Browser-native CSS has absorbed more responsibilities that once required naming discipline, preprocessors, or JavaScript. The architecture should adopt those capabilities at different confidence levels rather than treating “modern CSS” as one compatibility tier.
Cascade layers, native nesting, relational selectors, custom properties, size container queries, color-scheme support, and forced-colors handling can form the normal architecture baseline.
@scope became Baseline Newly available in December 2025. anchor-scope and contrast-color() became Baseline 2026. They are viable when the support policy permits current browser generations.
CSS custom functions and if() are powerful but remain limited availability. Advanced style, scroll-state, and anchored container-query subfeatures also require compatibility checks and explicit fallbacks.
Decision navigator
Choose the boundary that must be enforced. Distribution, host ownership, build tooling, type safety, and compatibility matter more than methodology preference.
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 layers, custom properties, nesting, selectors, queries, and policy-gated scoping as the architecture substrate.
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.
Native selector boundary
@scope limits selector reach to a subtree and can define a lower boundary without increasing selector specificity.
Best fitRich-text regions, embedded demos, component subtrees, and current-browser applications.
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
Tailwind v4 uses CSS-first configuration and exposes theme values as CSS variables while retaining utility-first markup authorship and generated output.
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 definitions into collision-resistant atomic CSS; v0.19 adds compile-time inline atoms with the same output model.
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.
Native component contract
Treat custom properties as component inputs, semantic attributes as finite state, and container queries as context adaptation.
Best fitReusable components that need portable theming, density, tone, and layout inputs.
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 |
Native @scope | Selector reach boundary | No | No | Medium | ●●○○ | ●●●● | Very low |
| CSS component APIs | Portable inputs and state | No | No | Contract | ●●○○ | ●●●● | 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.
Compatibility governance
Baseline is a portfolio policy, not a badge collection. Assign every feature to a dependency lane and preserve a usable fallback when the lane is not core.
@layer, custom properties, native nesting, :has(), Grid, Flexbox, and logical propertiescolor-scheme, forced-colors, reduced motion, and semantic HTML@scope for bounded selector reachanchor-scope for anchored UI ownershipcontrast-color() as an aid—not a replacement for a contrast auditif()/* Core fallback */
.card__body {
display: grid;
gap: var(--space-4);
}
/* Current-browser enhancement */
@supports at-rule(@scope) {
@scope (.card) to (.embedded-widget) {
:scope { container-type: inline-size; }
}
}
Recommended synthesis
The goal is not to select one ideology. It is to assign one clear responsibility to each layer.
Layers, custom properties, size container queries, logical properties, selectors, and a declared feature-maturity policy.
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.
Use @scope for selector reach where supported, while retaining semantic classes as the durable ownership vocabulary.
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 ownership, semantic attribute state, and size-container responsiveness. @scope is permitted by browser policy; limited-availability CSS remains progressive.
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 problem they solve and assessed against build cost, runtime cost, scope strength, enforcement, portability, lock-in, browser maturity, and delivery context. Standards and compatibility references are Evidence A. Official product documentation is Evidence B for intended capability. Recommendations are Evidence J architectural judgments.
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-contrastEvidence A. Defines Widely available, Newly available, and limited-availability compatibility categories.
web.dev/baseline@functionEvidence A. Defines custom CSS functions and documents limited availability.
developer.mozilla.org/.../@functionif()Evidence A. Defines conditional CSS values, fallback requirements, and limited availability.
developer.mozilla.org/.../if()Evidence A. Describes container-query types and current style-query limitations.
developer.mozilla.org/.../Container_size_and_style_queriesEvidence A. Describes scrollable, scrolled, snapped, and stuck container-state conditions.
developer.mozilla.org/.../Container_scroll-state_queriesanchor-scopeEvidence A. Documents Baseline 2026 support and subtree limits for anchor association.
developer.mozilla.org/.../anchor-scopeEvidence B. Official release documentation for CSS-first configuration and CSS theme variables.
tailwindcss.com/blog/tailwindcss-v4Evidence B. Official release documentation for compile-time inline atoms and current tooling direction.
stylexjs.com/blogcontrast-color()Evidence A. Documents Baseline 2026 support and automatic contrasting color behavior.
developer.mozilla.org/.../contrast-color()Evidence A. Documents the native nesting model and widely available nesting selector.
developer.mozilla.org/.../Nesting