Propiedad de ruta de clip CSS
Ejemplo
Recorte una imagen en un círculo del 50%:
img {
clip-path:
circle(50%);
}
Definición y uso
La clip-path
propiedad le permite recortar un elemento a una forma básica o a una fuente SVG.
Nota: La clip-path
propiedad reemplazará a la propiedad en desuso clip
.
Valor por defecto: | ninguna |
---|---|
Heredado: | No |
Animable: | sí para forma básica . Leer sobre animable |
Versión: | Módulo de enmascaramiento CSS Nivel 1 |
Sintaxis de JavaScript: | objeto .style.clipPath="círculo(50%)" |
Compatibilidad con navegador
Los números de la tabla especifican la primera versión del navegador que es totalmente compatible con la propiedad.
Property | |||||
---|---|---|---|---|---|
clip-path | 55.0 23.0 -webkit- |
79.0* | 54.0 | 9.1 6.1 -webkit- |
42.0 15.0 -webkit- |
* Antes de la versión 79, Edge solo admitía clip-path en elementos SVG (no en elementos HTML).
Sintaxis CSS
clip: clip-source|basic-shape|margin-box|border-box|padding-box|content-box|fill-box|stroke-box|view-box|none|initial|inherit;
Valores de propiedad
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 |