Rules Hub
Code Ruleset
Rule priority, scope & exceptions
Use this to align rules with the senior-level structure (P0/P1/P2, scope, exceptions/tradeoffs).
Use :global() only in CSS Module files
Use :global only where the configured stylesheet processor supports it; use a normal selector in plain global CSS.
Bad example
| 1 | /* styles.scss (not a CSS module) */ |
| 2 | :global(.foo) { color: red; } /* :global does nothing here */ |
Explanation (EN)
A framework-only selector left in the browser output cannot apply the intended style.
Objašnjenje (HR)
Good example
| 1 | /* plain global stylesheet */ |
| 2 | .foo { color: red; } |
Explanation (EN)
No module escape is needed for a stylesheet already treated as global.
Objašnjenje (HR)
Notes (EN)
Check the actual CSS processing pipeline before using :global; it must be transformed by CSS Modules or another framework that defines that syntax.
Exceptions / Tradeoffs (EN)
The filename alone does not prove module processing. In unprocessed browser CSS, :global is not a standard pseudo-class and the rule will not behave as a normal global selector.