This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
The <clipPath> SVG element defines a clipping path, to be used by the 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.
| Categories | None |
|---|---|
| Permitted content | Any number of the following elements, in any order: Animation elements Descriptive elements Shape elements <text>, <use>
|
clipPathUnitsDefines the coordinate system for the contents of the <clipPath> element. Value type: userSpaceOnUse | objectBoundingBox; Default value: userSpaceOnUse; Animatable: yes
This element implements the SVGClipPathElement interface.
<svg viewBox="0 0 100 100">
<clipPath id="myClip">
<!--
Everything outside the circle will be
clipped and therefore invisible.
-->
<circle cx="40" cy="35" r="35" />
</clipPath>
<!-- The original black heart, for reference -->
<path
id="heart"
d="M10,30 A20,20,0,0,1,50,30 A20,20,0,0,1,90,30 Q90,60,50,90 Q10,60,10,30 Z" />
<!--
Only the portion of the red heart
inside the clip circle is visible.
-->
<use clip-path="url(#myClip)" href="#heart" fill="red" />
</svg>
/* With a touch of CSS for browsers who *
* implemented the r Geometry Property. */
@keyframes openYourHeart {
from {
r: 0;
}
to {
r: 60px;
}
}
#myClip circle {
animation: openYourHeart 15s infinite;
}
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 clip-path property, or a child of the referencing element) must remain the same as if it were not clipped.
By default, 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.
| Specification |
|---|
| CSS Masking Module Level 1> # ClipPathElement> |
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | WebView Android | WebView on iOS | |
clipPath |
1 | 12 | 1.5 | 9 | 3 | 18 | 4 | 14 | 3 | 1.0 | 3 | 3 |
clipPathUnits |
1 | 12 | 1.5 | 15 | 3 | 18 | 4 | 14 | 3 | 1.0 | 4.4 | 3 |
systemLanguage |
1 | 12 | 12 | 9 | 3 | 18 | 14 | 14 | 3 | 1.0 | 3 | 3 |
<mask>clip-path property
© 2005–2025 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/SVG/Reference/Element/clipPath