Propriété CSS clip-path
Exemple
Découpez une image dans un cercle à 50 % :
img {
clip-path:
circle(50%);
}
Définition et utilisation
La clip-path
propriété vous permet de découper un élément sur une forme de base ou sur une source SVG.
Remarque : La clip-path
propriété remplacera la clip
propriété obsolète.
Valeur par défaut: | rien |
---|---|
Hérité: | non |
Animable : | oui pour la forme de base . En savoir plus sur l'animation |
Version: | Module de masquage CSS niveau 1 |
Syntaxe JavaScript : | objet .style.clipPath="cercle (50%)" |
Prise en charge du navigateur
Les nombres dans le tableau indiquent la première version du navigateur qui prend entièrement en charge la propriété.
Property | |||||
---|---|---|---|---|---|
clip-path | 55.0 23.0 -webkit- |
79.0* | 54.0 | 9.1 6.1 -webkit- |
42.0 15.0 -webkit- |
* Avant la version 79, Edge ne prenait en charge que le chemin de clip sur les éléments SVG (pas les éléments HTML).
Syntaxe CSS
clip: clip-source|basic-shape|margin-box|border-box|padding-box|content-box|fill-box|stroke-box|view-box|none|initial|inherit;
Valeurs de propriété
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 |