企业🤖AI Agent构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
## clip 属性 ### 属性定义及使用说明 如果图像大于包含它的元素,会发生什么?-clip属性,让你指定一个绝对定位的元素,该尺寸应该是可见的,该元素被剪裁成这种形状并显示。 **注意:** 如果先有"overflow:visible",clip属性不起作用。 JavaScript 语法:object.style.clip="rect(0px,50px,50px,0px)" * * * ## 属性值 | 值 | 描述 | | --- | --- | | *shape* | 设置元素的形状。唯一合法的形状值是:rect (*top*, *right*, *bottom*, *left*) | | auto | 默认值。不应用任何剪裁。 | | inherit | 规定应该从父元素继承 clip 属性的值。 | * * * ## 实例--裁剪一张图像: ``` <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>W3Cschool教程(w3cschool.cn)</title> <style> img { position:absolute; clip:rect(0px,60px,200px,0px); } </style> </head> <body> <img src="/attachments/cover/cover_cssref.jpeg" width="100" height="140" /> </body> </html> ```