CodesCompiler
πŸ”
HTMLCSSJavaScriptPythonSQLPHPSEOPostsBooksKids About Contact πŸš€ Get Started Free

CSS - clip Property

CSS - clip Property

CSS clip property is used to create a clipping region for an element, which defines the visible area of the element. Only the specified region will be visible and other regions will be hidden. The clip property only applies to elements with absolute or fixed positioning.

Syntax

CSS CODE
clip: auto | shape | initial | inherit;

Property Values

ValueDescription
autoNo clipping will be applied to the element. Default value.
shapeIt clips an element. The only value possible is rect(top, right, bottom, left) .
initialIt sets the property to its default value.
inheritIt inherits the property from the parent element.

Examples of CSS Clip Property

The following examples explain the clip property with different values.

Clip Property with Auto Value

To not clip an absolute or fixed positioned element, so that the entire element is visible, we use the auto value of the clip porperty. This is shown in the following example.

Example

Preview

Clip Property with rect() Value

To clip portion of an absolute or fixed positioned element such that only the specified region is visible and remaining region is not visible, we use the rect(top, right, bottom, left) value of the clip property. The specified value will clip the element from the top and left edges. This is shown in the following example.

Example

Preview

Clip Property with Images

The clip property can also be used with absolute or fixed positioned images. In the following example, auto and rect(top, right, bottom, left) values have been used with the image.

Example

Preview

Note:

  • The clip property is deprecated and replaced by clip-path property

  • The clip property will not work if β€˜overflow: visible’

Supported Browsers

Property
clip1.08.01.01.07.0