--- title: clip slug: Web/CSS/clip translation_of: Web/CSS/clip ---
clip 属性定义了元素的哪一部分是可见的。clip 属性只适用于 {{ cssxref("position","position:absolute") }} 的元素。
警告:这个属性已被废弃。建议使用 {{cssxref("clip-path")}} 。
{{cssinfo}}
形式语法: {{csssyntax("clip")}}
clip: rect(1px, 10em, 3rem, 2ch) clip: auto clip: inherit
<shape>rect(<top>, <right>, <bottom>, <left>) /* 标准语法 */或
rect(<top> <right> <bottom> <left>) /* 向后兼容语法 */
<top> 和 <bottom> 指定相对于盒子上边框边界 的偏移,<right> 和 <left> 指定了相对于盒子左边框边界 的偏移。<top>, <right>, <bottom>, 和 <left> 的值可以是 {{cssxref("<length>")}} 值或 auto。autop { border:dotted; position:relative; }
#img2 {
position:absolute; left:263px;
clip: rect(40px, 200px, 150px, 30px);
/* 标准语法,Internet Explorer 4-7 不支持 */
}
#img3 {
position: absolute; left:526px;
clip: rect(40px 200px 150px 30px);
/* 非标准语法,但是包括火狐与 IE 在内的主要浏览器均支持 */
}

| Specification | Status | Comment |
|---|---|---|
| {{ SpecName('CSS3 Transitions', '#animatable-css', 'clip') }} | {{ Spec2('CSS3 Transitions') }} | Defines clip as animatable. |
| {{ SpecName('CSS2.1', 'visufx.html#clipping', 'clip') }} | {{ Spec2('CSS2.1') }} |