Style clip attribute
- Previous Page clear
- Next Page color
- Go to Parent Level HTML DOM Style Object
Definition and usage
clip
Set or return which part of the positioning element is visible.
See also:
CSS Tutorial:CSS Positioning
CSS Reference Manual:clip attribute
Instance
Example 1
Clip the image into the specified shape:
document.getElementById("myImg").style.clip = "rect(0px 75px 75px 0px)";
Example 2
Return the clip attribute:
alert(document.getElementById("myImg").style.clip);
Syntax
Return the clip attribute:
object.style.clip
Set the clip attribute:
object.style.clip = "auto|rect(top right bottom left)|initial|inherit"
Attribute value
Value | Description |
---|---|
auto | Default. Does not clip the element. |
rect(top right bottom left) | Shapes are clipped by four coordinates. |
initial | Set this attribute to its default value. See also initial. |
inherit | This attribute inherits from its parent element. See also inherit. |
Technical details
Default value: | None |
---|---|
Return Value: | A string representing the visible part of the positioned element. |
CSS Version: | CSS2 |
Browser Support
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
Support | Support | Support | Support | Support |
- Previous Page clear
- Next Page color
- Go to Parent Level HTML DOM Style Object