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
cssselectorsmaintainability
Prefer :last-child over a hardcoded :nth-child index
Target the final element with :last-child rather than a brittle :nth-child(N) that breaks when the count changes.
PR: frontpage-web · org-mining-hist-2026-06Created: Jun 18, 2026
Bad example
Old codecss
| 1 | .container > div:nth-child(6) { |
| 2 | margin-bottom: 0; |
| 3 | } |
Explanation (EN)
Objašnjenje (HR)
Good example
New codecss
| 1 | .container > div:last-child { |
| 2 | margin-bottom: 0; |
| 3 | } |
Explanation (EN)
Objašnjenje (HR)