Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

CSS clip-path property

CSS clip-path property

Example

Clip an image to display 50% in a circular shape:

img

{

clip-path:

circle

(

50

%

)

;

}

Try it »


Property definition and usage

The clip-path property creates a displayable region of an element using clipping. Parts inside the region are shown, and parts outside are hidden. Several specific shapes can be specified.

Note: The clip-path property replaces the deprecated clip property.

Default value: none
Inherited: no
Animatable: support. 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 indicate the first browser version that supports this property.

property
clip-path 55.0
23.0 -webkit- 79.0* 54.0 9.1
6.1 -webkit- 42.0
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;

Attribute values

Value Description
clip-source Use a URL to represent the path of the clipping element
basic-shape Clip an element to a basic shape: circle, ellipse, polygon, or inset
margin-box Use the margin box as the reference box
border-box Use the border box as the reference box
padding-box Use the padding box as the reference box
content-box Use the content box as the reference box
fill-box Use the object bounding box as the reference box
stroke-box Use the stroke bounding box as the reference box
view-box Use the nearest SVG viewport as the reference box.
none This is the default setting. No clipping
initial Set the property to its default value. Read about initial
inherit The property value is inherited from the parent element. Read about inherit