clip-rule

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since ⁨July 2020⁩.

The clip-rule attribute only applies to graphics elements that are contained within a <clipPath> element. The clip-rule attribute basically works as the fill-rule attribute, except that it applies to <clipPath> definitions.

Note: As a presentation attribute, clip-rule also has a CSS property counterpart: clip-rule. When both are specified, the CSS property takes priority.

The following fragment of code will cause an evenodd clipping rule to be applied to the clipping path because clip-rule is specified on the <path> element that defines the clipping shape:

whereas the following fragment of code will not cause an evenodd clipping rule to be applied because the clip-rule is specified on the referencing element, not on the object defining the clipping shape:

Usage notes

Value nonzero | evenodd | inherit
Default value nonzero
Animatable Yes
nonzero

See description of fill-rule property.

evenodd

See description of fill-rule property.

Example

Elements

The following elements can use the clip-rule attribute, but only if they are inside a <clipPath> element.

Specifications

Specification
CSS Masking Module Level 1
# the-clip-rule

Browser compatibility

See also