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
cssunitstypographytruncation
Use the ch unit for character-based width limits
Cap text width by character count with the CSS ch unit instead of approximating with pixels.
PR: hegnar-forum-web · org-mining-hist-2026-06Created: Jun 20, 2026
Bad example
Old codescss
| 1 | .name { |
| 2 | max-width: 280px; /* roughly 40 chars */ |
| 3 | overflow: hidden; |
| 4 | text-overflow: ellipsis; |
| 5 | } |
Explanation (EN)
Objašnjenje (HR)
Good example
New codescss
| 1 | .name { |
| 2 | max-width: 40ch; |
| 3 | overflow: hidden; |
| 4 | text-overflow: ellipsis; |
| 5 | } |
Explanation (EN)
Objašnjenje (HR)