Rules Hub
Code Ruleset
Rule priority, scope & exceptions
Use this to align rules with the senior-level structure (P0/P1/P2, scope, exceptions/tradeoffs).
Round pixel values and avoid decimals in CSS
Use the intended design value instead of unexplained fractional pixel literals; preserve deliberate subpixel geometry.
Bad example
| 1 | .bar { width: 307.5px; } |
Explanation (EN)
An arbitrary copied decimal can drift from the intended design scale.
Objašnjenje (HR)
Good example
| 1 | .bar { width: 307px; } |
Explanation (EN)
Objašnjenje (HR)
Notes (EN)
Question an unexplained fractional hardcoded dimension when it conflicts with the verified design token or sizing convention; establish the intended geometry before changing it.
Exceptions / Tradeoffs (EN)
Fractional CSS pixels are valid and can be required for responsive layout, device scaling, transforms or exact design proportions. Rounding changes layout and is not a behavior-preserving cleanup.