Rules Hub
Code Ruleset
Rule priority, scope & exceptions
Use this to align rules with the senior-level structure (P0/P1/P2, scope, exceptions/tradeoffs).
Apply a style only at the breakpoints where it has an effect
Scope properties like z-index or positioning to the breakpoint where they actually matter, instead of applying them globally and breaking smaller viewports.
Bad example
| 1 | /* applied at all sizes, but only needed on desktop, and breaks mobile */ |
| 2 | .searchResults { width: 504px; top: 100%; z-index: 50; } |
Explanation (EN)
A desktop-only size or stacking override can break the smaller layout.
Objašnjenje (HR)
Good example
| 1 | .searchResults { position: absolute; top: 100%; width: 100%; } |
| 2 | @media (min-width: 1024px) { |
| 3 | .searchResults { width: 504px; z-index: 50; } |
| 4 | } |
Explanation (EN)
The common anchored positioning is preserved while the desktop size and stacking override are scoped to their intended breakpoint.
Objašnjenje (HR)
Notes (EN)
For a layout fix intended for one viewport range, inspect existing mobile defaults, media queries and computed positioning before moving declarations into a breakpoint.
Exceptions / Tradeoffs (EN)
Keep properties shared by all sizes outside the query; do not drop a needed top/position declaration as an incidental part of the move.