CKTIS / CSS
clip-rule — the SVG clipping-region interior rule
clip-rule determines which parts of a compound SVG shape belong to a clipping region. Its nonzero and evenodd values differ in how they handle intersections and nested subpaths.
Version: CSS modules; structured CSSWG indexes reconciled with pinned MDN BCD; Chromium 152 scope gate, per-example verification still required
Syntax
clip-rule: nonzero | evenodd;clip-rule affects graphics elements inside clipPath, not the element referencing it through clip-path. The property is inherited; its initial value is nonzero, and its animation is discrete.
nonzero sums crossings of a ray from the tested point, accounting for crossing direction: a nonzero sum means inside. evenodd counts crossings without direction: an odd count means inside. Consequently, nested subpaths with the same winding direction create a hole with evenodd, but not with nonzero.
fill-rule controls the fill interior; clip-rule controls the clipping-region interior. clip-rule does not apply to CSS <basic-shape> values such as polygon().
The example sets the rule on the path defining the clipping region. The expected result is a blue frame with a white center; switching to nonzero removes the hole.
Examples
<!doctype html>
<meta charset="utf-8">
<title>clip-rule</title>
<style>
#cutout { clip-rule: evenodd; }
</style>
<svg xmlns="http://www.w3.org/2000/svg" width="120" height="120" viewBox="0 0 120 120">
<defs>
<clipPath id="window">
<path id="cutout" d="M10 10H110V110H10Z M40 40H80V80H40Z"/>
</clipPath>
</defs>
<rect width="120" height="120" fill="white"/>
<rect width="120" height="120" fill="royalblue" clip-path="url(#window)"/>
</svg>Result
Expected: a royalblue square frame on white, with outer bounds (10, 10)–(110, 110) and a white central opening (40, 40)–(80, 80).
The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.