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
csslayoutsizingclean-code
Size elements with padding/font-size before reaching for fixed dimensions
Prefer intrinsic sizing (padding + font-size) over hardcoded width/height where it gives the right result, falling back to fixed dimensions only when needed for stability across zoom/browsers.
PR: hegnar-components · org-mining-hist-2026-06Created: Jun 18, 2026
Bad example
Old codescss
| 1 | .btn { width: 32px; height: 32px; } |
Explanation (EN)
Objašnjenje (HR)
Good example
New codescss
| 1 | .btn { padding: 0.375rem; line-height: 1; } |
| 2 | // keep fixed dimensions only if zoom/browser edge cases require it |
Explanation (EN)
Objašnjenje (HR)