Export (0) Print
Expand All
top
Expand Minimize

clip

Sets which part of a positioned object is visible.

Syntax

{ clip: sClip }

Possible values

sClip

String that specifies one of the following values:

auto

Default. Clip to expose entire object.

rect (top right bottom left)

The values top, right, bottom, and left specify length values, any of which can be replaced by auto, leaving that side not clipped. The value of top specifies that everything above this value on the Y axis (with 0 at the top) is clipped. The value of right specifies that everything above this value on the X axis (with 0 at the left) is clipped. The value of bottom specifies that everything below this value on the Y axis (with 0 at the top) is clipped. The value of left specifies that everything to the left of this value on the X axis (with 0 at the left) is clipped.

This property has a default value of auto. It is not inherited.

Remarks

This property defines the shape and size of the positioned object that is visible. The position must be set to absolute. Any part of the object that is outside the clipping region is transparent. Any coordinate can be replaced by the value auto, which exposes the respective side (that is, the side is not clipped).

The order of the values clip:rect (0 0 50 50) renders the object invisible because it sets the top and right positions of the clipping region to 0. To achieve a 50-by-50 view port, use clip:rect(0 50 50 0).

The clip property is available on the Macintosh operating system, as of Microsoft Internet Explorer 5.

Examples

The following example shows how to use an in-line style to clip the image:

<html>
<body>
  <div style="position: absolute; top: 0; left: 200; clip: rect(15px auto auto auto);">
    <img src="sphere.jpg"/>
  </div>
  <div style="position: absolute; top: 0; left: 300; clip: rect(auto 15px auto auto);">
    <img src="sphere.jpg"/>
  </div>
  <div style="position: absolute; top: 0; left: 400; clip: rect(auto auto 15px auto);">
    <img src="sphere.jpg"/>
  </div>
  <div style="position: absolute; top: 0; left: 500; clip: rect(auto auto auto 15px);">
    <img src="sphere.jpg"/>
  </div>
</body>
</html>

Standards information

This property is defined in Cascading Style Sheets (CSS), Level 2 (CSS2) Ee371188.xtlink_newWindow(en-us,Expression.40).png.

Applies to

a, address, applet, b, bdo, big, blockquote, button, center, cite, code, custom, dd, defaults, dfn, div, dl, dt, em, embed, fieldset, form, hn, hr, i, iframe, img, input type=button, input type=checkbox, input type=file, input type=image, input type=password, input type=radio, input type=reset, input type=submit, input type=text, li, object, ol, p, ruby, s, select, span, sub, table, td, th, tr, tt, u, ul, var, xmp

See also

Concepts

overflow

Send feedback about this topic to Microsoft. © 2011 Microsoft Corporation. All rights reserved.

Community Additions

ADD
Show:
© 2014 Microsoft