Path: blob/main/files/en-us/web/svg/element/clippath/index.md
6579 views
------{{SVGRef}}
The <clipPath> SVG element defines a clipping path, to be used by the {{SVGAttr("clip-path")}} property.
A clipping path restricts the region to which paint can be applied. Conceptually, parts of the drawing that lie outside of the region bounded by the clipping path are not drawn.
Example
{{EmbedLiveSample('Example', 100, 100)}}
A clipping path is conceptually equivalent to a custom viewport for the referencing element. Thus, it affects the rendering of an element, but not the element's inherent geometry. The bounding box of a clipped element (meaning, an element which references a <clipPath> element via a {{SVGAttr("clip-path")}} property, or a child of the referencing element) must remain the same as if it were not clipped.
By default, {{cssxref("pointer-events")}} are not dispatched on clipped regions. For example, a circle with a radius of 10 which is clipped to a circle with a radius of 5 will not receive "click" events outside the smaller radius.
Attributes
{{SVGAttr("clipPathUnits")}}
: Defines the coordinate system for the contents of the
<clipPath>element. Value type:userSpaceOnUse|objectBoundingBox; Default value:userSpaceOnUse; Animatable: yes
Global attributes
: Most notably: {{SVGAttr('id')}}
: {{SVGAttr('class')}}, {{SVGAttr('style')}}
Conditional Processing Attributes
: Most notably: {{SVGAttr('requiredExtensions')}}, {{SVGAttr('systemLanguage')}}
: Most notably: {{SVGAttr('clip-path')}}, {{SVGAttr('clip-rule')}}, {{SVGAttr('color')}}, {{SVGAttr('display')}}, {{SVGAttr('fill')}}, {{SVGAttr('fill-opacity')}}, {{SVGAttr('fill-rule')}}, {{SVGAttr('filter')}}, {{SVGAttr('mask')}}, {{SVGAttr('opacity')}}, {{SVGAttr('shape-rendering')}}, {{SVGAttr('stroke')}}, {{SVGAttr('stroke-dasharray')}}, {{SVGAttr('stroke-dashoffset')}}, {{SVGAttr('stroke-linecap')}}, {{SVGAttr('stroke-linejoin')}}, {{SVGAttr('stroke-miterlimit')}}, {{SVGAttr('stroke-opacity')}}, {{SVGAttr('stroke-width')}}, {{SVGAttr("transform")}}, {{SVGAttr('vector-effect')}}, {{SVGAttr('visibility')}}
Usage notes
{{svginfo}}
Specifications
{{Specifications}}
Browser compatibility
{{Compat}}
Related
Other clipping and masking SVG elements: {{SVGElement("mask")}}
Some CSS properties: {{cssxref("clip-path")}}, {{cssxref("pointer-events")}}