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

CSS clip property

CSS clip property

Example

Clip an image:

img

{

position:

absolute

;

clip:

rect

(

0

px

,

60

px

,

200

px

,

0

px

)

;

}

Try it »


Property definition and usage

What happens if an image is larger than the element containing it? The clip property lets you specify an absolutely positioned element and the size that should be visible; the element is clipped to that shape and displayed.

Note:: If "overflow:visible" is set first, the clip property has no effect.

Default value: auto
Inherited: no
Version: CSS2
JavaScript syntax: object.style.clip="rect(0px,50px,50px,0px)"

Browser support

The numbers in the table indicate the first browser version that supports this property.

property
clip 1.0 8.0 1.0 1.0 7.0

Attribute values

Value Description
shape Sets the shape of the element. The only valid shape value is: rect (top, right, bottom, left)
auto Default. No clipping is applied.
inherit Specifies that the clip property should be inherited from the parent element.

Related Articles

CSS Tutorial: CSS Positioning