CSS clip-path eigenschap
Voorbeeld
Knip een afbeelding uit tot een cirkel van 50%:
img {
clip-path:
circle(50%);
}
Definitie en gebruik
Met de clip-path
eigenschap kunt u een element naar een basisvorm of naar een SVG-bron knippen.
Opmerking: het clip-path
pand vervangt het verouderde clip
pand.
Standaardwaarde: | geen |
---|---|
geërfd: | Nee |
Animeerbaar: | ja voor basisvorm . Lees over animeren |
Versie: | CSS-maskermodule niveau 1 |
JavaScript-syntaxis: | object .style.clipPath="cirkel (50%)" |
Browserondersteuning
De getallen in de tabel geven de eerste browserversie aan die de eigenschap volledig ondersteunt.
Property | |||||
---|---|---|---|---|---|
clip-path | 55.0 23.0 -webkit- |
79.0* | 54.0 | 9.1 6.1 -webkit- |
42.0 15.0 -webkit- |
* Vóór versie 79 ondersteunde Edge alleen clippad op SVG-elementen (geen HTML-elementen).
CSS-syntaxis
clip: clip-source|basic-shape|margin-box|border-box|padding-box|content-box|fill-box|stroke-box|view-box|none|initial|inherit;
Eigendomswaarden
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 |