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: HTML/CSS
imagesperformancelayout-shiftcls
Match image intrinsic width/height to its rendered size
An img with intrinsic dimensions far larger than the CSS-rendered size causes layout shift and scaling; align them or rely on CSS sizing.
PR: hegnar-bellsheep-web · org-mining-hist-2026-06Created: Jun 18, 2026
Bad example
Old codetsx
| 1 | <img src={url} width={98} height={98} className="h-10 w-10" /> <!-- 98px intrinsic, 40px rendered --> |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetsx
| 1 | <img src={url} className="h-10 w-10 lg:h-[98px] lg:w-[98px]" /> <!-- size driven by CSS --> |
Explanation (EN)
Objašnjenje (HR)