Thuộc tính đường dẫn clip CSS
Định nghĩa và cách sử dụng
Thuộc tính clip-path
cho phép bạn cắt một phần tử thành hình dạng cơ bản hoặc thành nguồn SVG.
Lưu ý: Thuộc tính clip-path
thay thế thuộc tính clip
không được dùng nữa.
Giá trị mặc định: | không có |
---|---|
Thừa hưởng: | KHÔNG |
Hoạt hình: | có cho hình dạng cơ bản . Đọc về hoạt hình Hãy thử nó |
Phiên bản: | Mô-đun mặt nạ CSS cấp 1 |
Cú pháp JavaScript: | object .style.clipPath="circle(50%)" Hãy thử nó |
Hỗ trợ trình duyệt
Các số trong bảng chỉ định phiên bản trình duyệt đầu tiên hỗ trợ đầy đủ thuộc tính.
Property | |||||
---|---|---|---|---|---|
clip-path | 55.0 23.0 -webkit- |
79.0 | 3.5 | 9.1 6.1 -webkit- |
42.0 15.0 -webkit- |
Cú pháp CSS
clip: clip-source | basic-shape |margin-box|border-box|padding-box|content-box|fill-box|stroke-box|view-box|none|initial|inherit;
Giá trị tài sản
Value | Description | Demo |
---|---|---|
clip-source | Defines a URL to an SVG <clipPath> element | |
basic-shape | Clips an element to a basic shape: circle, ellipse, polygon or inset | Demo ❯ |
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 |