CSS clip-path Property
Definition and Usage
The clip-path
property
lets you clip an element to a basic shape or to an SVG source.
Note: The clip-path
property
replaces the deprecated clip
property.
Default value: | none |
---|---|
Inherited: | no |
Animatable: | yes for basic-shape. Read about animatable Try it |
Version: | CSS Masking Module Level 1 |
JavaScript syntax: | object.style.clipPath="circle(50%)" Try it |
Browser Support
The numbers in the table specify the first browser version that fully supports the property.
Property | |||||
---|---|---|---|---|---|
clip-path | 55 | 79 | 3.5 | 9.1 | 42 |
CSS Syntax
clip: clip-source|basic-shape|margin-box|border-box|padding-box|content-box|fill-box|stroke-box|view-box|none|initial|inherit;
Property Values
Value | Description | Demo |
---|---|---|
clip-source | Defines a URL to an SVG <clipPath> element | |
basic-shape | Clips an element to a basic shape: circle, ellipse, polygon or inset | Demo ❯ |
margin-box | Uses the margin box as the reference box | |
border-box | Uses the border box as the reference box | |
padding-box | Uses the padding box as the reference box | |
content-box | Uses the content box as the reference box | |
fill-box | Uses the object bounding box as reference box | |
stroke-box | Uses the stroke bounding box as reference box | |
view-box | Uses the SVG viewport as reference box | |
none | This is default. No clipping is done | |
initial | Sets this property to its default value. Read about initial | |
inherit | Inherits this property from its parent element. Read about inherit |