<div class="box circle"></div>
<div class="box ellipse"></div>
<div class="box inset"></div>
<div class="box polygon"></div>
<div class="box svg"></div>
<div class="box animate"></div <svg class="svg">
<clipPath id="triangle" clipPathUnits="objectBoundingBox">
<path d="M0.05,0.05 h1 v1"></path>
</clipPath>
</svg>
body {
display: flex;
align-items: center;
justify-content: center;
flex-wrap: wrap;
min-height: 100vh;
gap: 2rem;
}
.box {
background: teal;
width: 200px;
height: 200px;
}
.circle {
clip-path: circle(50% at center);
}
.ellipse {
clip-path: ellipse(50% 25% at 50% 50%);
}
.inset {
clip-path: inset(10px 20px 30px 40px round 15px 50px);
}
.polygon {
clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
}
.svg {
clip-path: url(#triangle);
}
.animate {
animation: move 5s infinite;
}
@keyframes move {
0% { clip-path: polygon(0 0, 50% 0, 100% 0, 100% 50%, 100% 100%, 50% 100%, 0 100%, 0 50%); }
50% { clip-path: polygon(50% 50%, 50% 25%, 50% 50%, 75% 50%, 50% 50%, 50% 75%, 50% 50%, 25% 50%); }
100% {
clip-path: polygon(0 0, 50% 0, 100% 0, 100% 50%, 100% 100%, 50% 100%, 0 100%, 0 50%);
}
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.