CSS clip-path Eiendom
Voorbeeld
Knip 'n prent na 'n 50% sirkel:
img {
clip-path:
circle(50%);
}
Definisie en gebruik
Die clip-path
eiendom laat jou toe om 'n element na 'n basiese vorm of na 'n SVG-bron te knip.
Let wel: Die clip-path
eiendom sal die verouderde clip
eiendom vervang.
Standaard waarde: | geen |
---|---|
Geërf: | geen |
Animateerbaar: | ja vir basiese vorm . Lees oor animeerbaar |
Weergawe: | CSS Maskering Module Vlak 1 |
JavaScript-sintaksis: | voorwerp .style.clipPath="sirkel(50%)" |
Blaaierondersteuning
Die nommers in die tabel spesifiseer die eerste blaaierweergawe wat die eiendom ten volle ondersteun.
Property | |||||
---|---|---|---|---|---|
clip-path | 55.0 23.0 -webkit- |
79.0* | 54.0 | 9.1 6.1 -webkit- |
42.0 15.0 -webkit- |
* Voor weergawe 79 het Edge slegs clip-path op SVG-elemente ondersteun (nie HTML-elemente nie).
CSS-sintaksis
clip: clip-source|basic-shape|margin-box|border-box|padding-box|content-box|fill-box|stroke-box|view-box|none|initial|inherit;
Eiendomswaardes
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 |