Rules Hub
Code Ruleset
← 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 ruleP2stack specificStack: css
cssmaintainabilityshapes
Use border-radius: 50% for circular elements
Use border-radius:50% for a circle whose used width and height are equal; percentage radii on a rectangle produce an ellipse.
PR: frontpage-web · org-mining-hist-2026-06Created: Jun 18, 2026
Bad example
Old codescss
| 1 | .dot { width: 20px; height: 20px; border-radius: 10px; } |
Explanation (EN)
A percentage radius follows a resizing square without a separately synchronized pixel radius.
Objašnjenje (HR)
Good example
New codescss
| 1 | .dot { width: 20px; height: 20px; border-radius: 50%; } |
Explanation (EN)
Objašnjenje (HR)
Notes (EN)
For a circular element that may resize, require equal used width and height before using a 50% border radius. Check padding, borders and box sizing.
Exceptions / Tradeoffs (EN)
Unequal dimensions produce an ellipse; a fixed radius is valid when dimensions are fixed and the design requires that exact geometry.