คุณสมบัติCSS คลิปพาธ
ตัวอย่าง
คลิปรูปภาพเป็นวงกลม 50%:
img {
clip-path:
circle(50%);
}
ความหมายและการใช้งาน
คุณสมบัติclip-path
ช่วยให้คุณตัดองค์ประกอบเป็นรูปร่างพื้นฐานหรือแหล่งที่มา SVG
หมายเหตุ:คุณสมบัติ จะแทนที่ คุณสมบัติclip-path
ที่เลิกใช้แล้วclip
ค่าเริ่มต้น: | ไม่มี |
---|---|
รับการถ่ายทอด: | ไม่ |
เคลื่อนไหวได้: | ใช่สำหรับรูปร่างพื้นฐาน อ่านเกี่ยวกับแอนิเมชั่น |
รุ่น: | CSS Masking Module ระดับ 1 |
ไวยากรณ์ JavaScript: | วัตถุ .style.clipPath="circle(50%)" |
รองรับเบราว์เซอร์
ตัวเลขในตารางระบุเบราว์เซอร์รุ่นแรกที่สนับสนุนคุณสมบัติอย่างสมบูรณ์
Property | |||||
---|---|---|---|---|---|
clip-path | 55.0 23.0 -webkit- |
79.0* | 54.0 | 9.1 6.1 -webkit- |
42.0 15.0 -webkit- |
* ก่อนเวอร์ชัน 79 Edge รองรับเฉพาะคลิปพาธในองค์ประกอบ SVG (ไม่ใช่องค์ประกอบ HTML)
ไวยากรณ์ CSS
clip: clip-source|basic-shape|margin-box|border-box|padding-box|content-box|fill-box|stroke-box|view-box|none|initial|inherit;
มูลค่าทรัพย์สิน
Value | Description | Play it |
---|---|---|
clip-source | Defines a URL to an SVG <clipPath> element | |
basic-shape | Clips an element to a basic shape: circle, ellipse, polygon or inset | |
margin-box | Uses the margin box as the reference box | |
border-box | Uses the border box as the reference box | |
padding-box | Uses the padding box as the reference box | |
content-box | Uses the content box as the reference box | |
fill-box | Uses the object bounding box as reference box | |
stroke-box | Uses the stroke bounding box as reference box | |
view-box | Uses the SVG viewport as reference box | |
none | This is default. No clipping is done | |
initial | Sets this property to its default value. Read about initial | |
inherit | Inherits this property from its parent element. Read about inherit |