clip property
Specifies which part of a positioned element is visible.
A positioned element is an element whose position property is set to relative, absolute or fixed.
This property only works for absolute or fixed positioned elements.
You can set the top, right, bottom, and left coordinates of the visible region with this property, relative to the upper-left corner of the element.
- The value of top defines a line, content above this line will be hidden.
- The value of bottom defines a line, content below this line will be hidden.
- The value of left defines a line, content left of this line will be hidden.
- The value of right defines a line, content right of this line will be hidden.
JavaScript page for this property: clip. You can find other example(s) there. |
Possible values:
One of the following values:
Default. The element does not clip. | |||||||
Takes the value of this property from the computed style of the parent element. | |||||||
Clips the shape defined by the four coordinates (top right bottom left). |
Default: auto.
Example HTML code 1:
This example illustrates the use of the clip property:
|
||||
<head> <style> .notclipped { position: absolute; top: 260px; left: 260px; width: 100px; height: 100px; border: 2px solid black; } .clipped { position: absolute; top: 260px; left: 260px; width: 100px; height: 100px; background-color: red; clip: rect(20px 70px 60px 10px); } </style> </head> <body> The black border represents a rectangle with size width and height of 100px. <br /> The red rectangle has size width and height of 100px too, with 'clip: rect(20px 70px 60px 10px)'. <br /> It means: <ul> <li>hide the area above the line 20px from top</li> <li>hide the area right form the line 70px from left</li> <li>hide the area below the line 60px from top</li> <li>hide the area left from the line 10px from left</li> </ul> <div class="notclipped"></div> <div class="clipped"></div> </body> |
||||
|
||||
Did you find this example helpful?
|
Supported by tags:
a, abbr, acronym, address, applet, b, bdo, big, blink, blockQuote, button, caption, center, cite, code, dd, del, dfn, dir, div, dl, dt, em, embed, fieldSet, font, form, H1, H2, H3, H4, H5, H6, hr, i, iframe, img, input:button, input:checkbox, input:file, input:image, input:password, input:radio, input:range, input:reset, input:search, input:submit, input:text, ins, isIndex, kbd, label, legend, li, listing, marquee, menu, nobr, object, ol, p, plainText, pre, q, rt, ruby, s, samp, select, small, span, strike, strong, sub, sup, table, td, textArea, th, tr, tt, u, ul, var, xmp
Related pages:
External links:
User Contributed Comments