Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

CSS clip property


May 05, 2021 CSS Reference Manual


Table of contents


CSS clip property


Crop an image:

Img
{
position:absolute;
clip:rect(0px,60px,200px,0px);
}

Try it out . . .

Description of property definition and use

What happens if the image is larger than the element that contains it? -clip property, which lets you specify an absolutely positioned element that should be visible, and the element is clipped to this shape and displayed.

Note: If you have "overflow:visible" first, the clip property does not work.

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


Browser support

The numbers in the table support the first browser version number of the property.

Attributes
clip 1.0 8.0 1.0 1.0 7.0

The property value

value describe
shape Set the shape of an element.The only legal shape value is: RECT ( top , right , bottom , left )
auto Defaults.No cut is applied.
inherit The value of the CLIP attribute should be inherited from the parent element.


Related articles

CSS tutorial: CSS Positioning