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
csslayoutspacingedge-cases
Put spacing on the always-present element, not the optional one
If an element may be conditionally absent, don't rely on its margin for layout spacing; place the spacing on a guaranteed sibling so the gap survives.
PR: frontpage-web · org-mining-hist-2026-06Created: Jun 18, 2026
Bad example
Old codescss
| 1 | .time { margin-bottom: rem-calc(30); } // .time may not render |
Explanation (EN)
Objašnjenje (HR)
Good example
New codescss
| 1 | .ingress { margin-top: rem-calc(30); } // ingress always present, keeps the gap |
Explanation (EN)
Objašnjenje (HR)