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 unitless line-height values
Specify line-height as a unitless multiplier so it scales with font size, instead of fixed px.
Bad example
| 1 | .text { font-size: 16px; line-height: 24px; } |
Explanation (EN)
A fixed inherited length can produce the wrong line spacing when child font sizes change.
Objašnjenje (HR)
Good example
| 1 | .text { font-size: 16px; line-height: 1.5; } |
Explanation (EN)
At 16px this retains 24px spacing while allowing descendants to scale their own line boxes.
Objašnjenje (HR)
Notes (EN)
For text whose line height should scale with font size, derive the unitless ratio from the actual font size and test nested text and zoom.
Exceptions / Tradeoffs (EN)
Keep a fixed line box where the component contract intentionally requires it; do not convert 24px to 1.5 without establishing a 16px font size.