The clip
defines a visible portion of an element. The clip
property applies only to absolutely positioned elements — that is, elements with position:absolute
or position:fixed
.
Example:
.dotted-border {
border: dotted;
position: relative;
width: 536px;
height: 350px;
}
#top-left,
#middle,
#bottom-right {
position: absolute;
top: 0;
}
#top-left {
left: 360px;
clip: rect(0, 175px, 113px, 0);
}
#middle {
left: 280px;
clip: rect(119px, 255px, 229px, 80px);
}
#bottom-right {
left: 200px;
clip: rect(235px, 335px, 345px, 160px);
}
<p class="dotted-border">
<img src="https://developer.mozilla.org/@api/deki/files/3613/=hut.jpg" title="Original graphic">
<img id="top-left" src="https://developer.mozilla.org/@api/deki/files/3613/=hut.jpg" title="Graphic clipped to upper left">
<img id="middle" src="https://developer.mozilla.org/@api/deki/files/3613/=hut.jpg" title="Graphic clipped towards middle">
<img id="bottom-right" src="https://developer.mozilla.org/@api/deki/files/3613/=hut.jpg" title="Graphic clipped to bottom right">
</p>