Rules Hub
Coding Rules Library
← Back to all rules
Rule priority, scope & exceptions
Use this to align rules with the senior-level structure (P0/P1/P2, scope, exceptions/tradeoffs).
frontend ruleP2universalStack: CSS
cssperformancelayoutcompositing
Prefer simple positioning over creating extra GPU composition layers
Centering with inset:0 + margin:auto is cheaper than translate-based centering, which forces a new composition layer / GPU acceleration. Reach for the lighter approach by default.
PR: hegnar-components · org-mining-hist-2026-06Created: Jun 18, 2026
Bad example
Old codescss
| 1 | .modal { top: 50%; left: 50%; transform: translate(-50%, -50%); } |
Explanation (EN)
Objašnjenje (HR)
Good example
New codescss
| 1 | .modal { position: fixed; inset: 0; margin: auto; width: 400px; height: fit-content; } |
Explanation (EN)
Objašnjenje (HR)