Rules Hub
Code Ruleset
Rule priority, scope & exceptions
Use this to align rules with the senior-level structure (P0/P1/P2, scope, exceptions/tradeoffs).
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.
Bad example
| 1 | .time { margin-bottom: rem-calc(30); } // .time may not render |
Explanation (EN)
An optional element cannot guarantee spacing for a layout state in which it is absent.
Objašnjenje (HR)
Good example
| 1 | .ingress { margin-top: rem-calc(30); } // ingress always present, keeps the gap |
Explanation (EN)
Objašnjenje (HR)
Notes (EN)
When spacing should remain even if an optional sibling is absent, attach it to the stable layout owner or use an appropriate parent gap/padding contract.
Exceptions / Tradeoffs (EN)
Spacing meant only between present siblings should disappear with the missing sibling. Moving margins can change margin collapse and edge spacing.