Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

Nos bénévoles n'ont pas encore traduit cet article en Français. Aidez-nous à réaliser cette tâche !

The <clipPath> SVG element defines a clipping path. A clipping path is used/referenced using the clip-path property.

The clipping path restricts the region to which paint can be applied. Conceptually, any parts of the drawing that lie outside of the region bounded by the currently active clipping path are not drawn.

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 must not be dispatched on the clipped (non-visible) regions of a shape. 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.

Usage context

CategoriesNone
Permitted contentAny number of the following elements, in any order:
Animation elements
Descriptive elements
Shape elements
<text>, <use>

Attributes

Global attributes

Specific attributes

DOM Interface

This element implements the SVGClipPathElement interface.

Examples

SVG

<svg width="120" height="120" xmlns="https://www.w3.org/2000/svg">
  <defs>
    <clipPath id="myClip">
      <circle cx="30" cy="30" r="20"/>
      <circle cx="70" cy="70" r="20"/>
    </clipPath>
  </defs>

  <rect x="10" y="10" width="100" height="100"
      clip-path="url(#myClip)"/>
</svg>

Result

SVG

<svg width="100" height="100" >
  <defs>
    <clipPath id="myClip">
      <rect x="0" y="10" width="100" height="35" />
      <rect x="0" y="55" width="100" height="35" />
    </clipPath>
  </defs>
  <circle cx="50" cy="50" r="50" clip-path="url(#myClip)" />
</svg>

Result

Specifications

Specification Status Comment
CSS Masking Level 1
The definition of '<clipPath>' in that specification.
Candidate Recommendation  
Scalable Vector Graphics (SVG) 1.1 (Second Edition)
The definition of '<clipPath>' in that specification.
Recommendation Initial definition

Browser compatibility

Feature Chrome Firefox (Gecko) IE Opera Safari
Basic support 1.0 1.5 (1.8) 9.0 9.0 3.0.4
Feature Android Firefox Mobile (Gecko) IE Phone Opera Mobile Safari Mobile
Basic support 3.0 1.0 (1.8) No support (Yes) 3.0.4

The chart is based on these sources.

Étiquettes et contributeurs liés au document

Étiquettes : 
 Contributeurs à cette page : JoeDeRose, mstijak, Sebastianz, Tigt, trevorh, kscarfone, Jeremie, Manuel_Strehl
 Dernière mise à jour par : JoeDeRose,