CSS clip-path
Property
Example
Clip an image to display as a circle showing 50%:
Property Definition and Usage
The clip-path
property creates a clipping region that sets what part of an element should be shown. Parts inside the region are shown, while those outside are hidden. Specific shapes can be specified.
Note: The clip-path
property replaces the deprecated clip
property.
Default value: | none |
---|---|
Inherited: | no |
--- | --- |
Animatable: | Yes. 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.0 <br>23.0 -webkit- | 79.0* | 54.0 | 9.1 <br>6.1 -webkit- | 42.0 <br>15.0 -webkit- |
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 |
---|---|
clip-source | Represents the path of the clipping element using a URL |
basic-shape | Clips the element to a basic shape: circle, ellipse, polygon, or inset |
margin-box | Uses the margin box as the reference box |
border-box | Uses the border 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 the reference box |
stroke-box | Uses the stroke bounding box as the reference box |
view-box | Uses the nearest SVG viewport as the reference box |
none | This is the default. No clipping |
initial | Sets the property to its default value. Read about initial |
inherit | The property value is inherited from the parent element. Read about inherit |