Keep component CSS local while preserving intentional sharing

These cases show private declaration CSS, named shared groups, per-instance payload overrides, static-style enforcement, fragment and external templates, anonymous declarations, descendant selectors, and stable keyframe rewriting.

Declaration styles are compiled into native @scope boundaries. Ordinary page cascade can still enter a component, while a declaration selector cannot leak into unrelated page elements.

See also

External template loading

Grid components and instance styling

Module maps and resource resolution

This page enables retained CSS loading. The final two samples load a local stylesheet and resolve its image through the nearest module map.

Private CSS uses native @scope (<cem-tag>); named shared CSS uses the public declaration-owned scope="name"; payload CSS uses an implicit parent-rooted @scope. An explicit uid-seed stabilizes internal render identity and rewritten keyframe names; it does not create a CSS boundary. Internal data-cem-render-scope is not a CSS hook, and no per-instance CSS marker is generated.