<!-- CSS -->
<style>
.box {
background: #800000;
width: 100px;
height: 100px;
clip-path: polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
}
</style>
<!-- HTML -->
<div class="box "></div>
<!-- Aplicado a una imagen -->
<img alt="Clip path" class="box" src="img.jpg"/>
Nota: En el cuadro adjunto, se facilitan los CSS para que selecciones y apliques el efecto de tu preferencia. Incluso, puedes insertar la clase box en la imagen para formatear la imagen con el modelo que elijas; como el ejemplo siguiente ---->
Modelos de clip-path
Figura | CSS | Figura | CSS | Figura | CSS |
---|---|---|---|---|---|
Triangle | clip-path: polygon(50% 0%, 0% 100%, 100% 100%); | Parallelogram | clip-path: polygon(25% 0%, 100% 0%, 75% 100%, 0% 100%); | Trapezoid | clip-path: polygon(20% 0%, 80% 0%, 100% 100%, 0% 100%); |
Rhombus | clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%); | Pentagon | clip-path: polygon(50% 0%, 100% 38%, 82% 100%, 18% 100%, 0% 38%); | Hexagon | clip-path: polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%); |
Heptagon | clip-path: polygon(50% 0%, 90% 20%, 100% 60%, 75% 100%, 25% 100%, 0% 60%, 10% 20%); | Octagon | clip-path: polygon(30% 0%, 70% 0%, 100% 30%, 100% 70%, 70% 100%, 30% 100%, 0% 70%, 0% 30%); | Nonagon | clip-path: polygon(50% 0%, 83% 12%, 100% 43%, 94% 78%, 68% 100%, 32% 100%, 6% 78%, 0% 43%, 17% 12%); |
Decagon | clip-path: polygon(50% 0%, 80% 10%, 100% 35%, 100% 70%, 80% 90%, 50% 100%, 20% 90%, 0% 70%, 0% 35%, 20% 10%); | Bevel | clip-path: polygon(20% 0%, 80% 0%, 100% 20%, 100% 80%, 80% 100%, 20% 100%, 0% 80%, 0% 20%); | Rabbet | clip-path: polygon(0% 15%, 15% 15%, 15% 0%, 85% 0%, 85% 15%, 100% 15%, 100% 85%, 85% 85%, 85% 100%, 15% 100%, 15% 85%, 0% 85%); |
Left arrow | clip-path: polygon(40% 0%, 40% 20%, 100% 20%, 100% 80%, 40% 80%, 40% 100%, 0% 50%); | Right arrow | clip-path: polygon(0% 20%, 60% 20%, 60% 0%, 100% 50%, 60% 100%, 60% 80%, 0% 80%); | Left point | clip-path: polygon(25% 0%, 100% 0%, 100% 100%, 25% 100%, 0% 50%); |
Right point | clip-path: polygon(0% 0%, 75% 0%, 100% 50%, 75% 100%, 0% 100%); | Left chevron | clip-path: polygon(100% 0%, 75% 50%, 100% 100%, 25% 100%, 0% 50%, 25% 0%); | Right chevron | clip-path: polygon(75% 0%, 100% 50%, 75% 100%, 0% 100%, 25% 50%, 0% 0%); |
Star | clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%); | Cross | clip-path: polygon(10% 25%, 35% 25%, 35% 0%, 65% 0%, 65% 25%, 90% 25%, 90% 50%, 65% 50%, 65% 100%, 35% 100%, 35% 50%, 10% 50%); | Message | clip-path: polygon(0% 0%, 100% 0%, 100% 75%, 75% 75%, 75% 100%, 50% 75%, 0% 75%); |
Close | clip-path: polygon(20% 0%, 0% 20%, 30% 50%, 0% 80%, 20% 100%, 50% 70%, 80% 100%, 100% 80%, 70% 50%, 100% 20%, 80% 0%, 50% 30%); | Frame | clip-path: polygon(0% 0%, 0% 100%, 25% 100%, 25% 25%, 75% 25%, 75% 75%, 25% 75%, 25% 100%, 100% 100%, 100% 0%); | Inset | clip-path: inset(5% 20% 15% 10%); |
Circle | clip-path: circle(50% at 50% 50%); | Ellipse | clip-path: ellipse(25% 40% at 50% 50%); | Crown | clip-path: polygon(48% 75%, 100% 38%, 82% 100%, 18% 100%, 0% 38%); |
¿Y ahora qué?