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: general
csscolorsmodern-cssstyling
Use rgb() with alpha instead of legacy rgba()
Modern rgb() supports an alpha channel; prefer it over the legacy rgba() syntax.
PR: startsiden/hegnar-bellsheep-web#387Created: Jun 17, 2026
Bad example
Old codecss
| 1 | .toast { |
| 2 | box-shadow: 0 8px 16px rgba(21, 23, 25, 0.14); |
| 3 | } |
Explanation (EN)
rgba() is the legacy form kept only for backwards compatibility.
Objašnjenje (HR)
rgba() je zastarjeli oblik zadrzan samo radi unatrazne kompatibilnosti.
Good example
New codecss
| 1 | .toast { |
| 2 | box-shadow: 0 8px 16px rgb(21 23 25 / 0.14); |
| 3 | } |
Explanation (EN)
Modern rgb() takes an alpha after a slash, so rgba() is no longer needed.
Objašnjenje (HR)
Moderni rgb() prima alpha nakon kose crte, pa rgba() vise nije potreban.