Version: Level 2
Compability: IE4+ N6
| Length | Abbrev. |
|---|---|
| centimeters | cm |
| ems | em |
| inches | in |
| millimeters | mm |
| picas | pc |
| pixels | px |
| points | pt |
The clip property can be used when an element is too big to fit inside the containing block. This property is not inherited.
A containing block is simply an element that contains related sub-elements. A problem arises if a sub-element is too big in size to fit inside the dimensions of the containing block. By default, when an element is too large to fit in the allotted space, portions will be chopped off so that the remaining portion of the element will fit inside the containing box. The portions that are chopped off are simply not displayed.
The clip property allows you to specify what portion of the over-sized sub-element will be visible. This is referred to as clipping the sub-element.
The related overflow property allows you to specify if an over-size element is to be clipped. If the overflow property is set to the visible value, then setting the clip property should have no effect. In this case, the over-sized element is completely displayed even though it overflows the boundaries of the containing block.
clip: rect(10px 60px 60px 10px);
height="75px";
width="75px";
position: absolute;
}
...
<img src="/images/guru.gif" height="75px" width="75px">
<br>
<img src="/images/guru.gif" class="clp">

In this example, the containing element is the HTML img tag which is sized as a square with dimensions of 75 pixels by 75 pixels.