Style clip Property

Clash Royale CLAN TAG#URR8PPP
<!--
main_leaderboard, all: [728,90][970,90][320,50][468,60]-->
Style clip Property
❮ Style Object
Example
Clip an image into a specified shape:
document.getElementById("myImg").style.clip = "rect(0px 75px 75px 0px)";Try it Yourself »
Definition and Usage
The clip property sets or returns which part of a positioned element is
visible.
Browser Support
| Property | |||||
|---|---|---|---|---|---|
| clip | Yes | Yes | Yes | Yes | Yes |
Syntax
Return the clip property:
object.style.clip
Set the clip property:
object.style.clip = "auto|rect(top right bottom left)|initial|inherit"
Property Values
| Value | Description |
|---|---|
| auto | Default. The element does not clip |
| rect(top right bottom left) | Clips the shape defined by the four coordinates |
| initial | Sets this property to its default value. Read about initial |
| inherit | Inherits this property from its parent element. Read about inherit |
<!--
mid_content, all: [300,250][336,280][728,90][970,250][970,90][320,50][468,60]-->
Technical Details
| Default Value: | auto |
|---|---|
| Return Value: | A String, representing the part of a positioned element that is visible |
| CSS Version | CSS2 |
More Examples
Example
Return the clip property:
alert(document.getElementById("myImg").style.clip);Try it Yourself »
Related Pages
CSS tutorial: CSS Positioning
CSS reference: clip property
❮ Style Object