Mrs. Lastri cuts a cloth on her work table: circle, ellipse, inset or a polygon with pins you drag, then elementsFromPoint answers where a tap on the cut-away…
Why it matters
clip-path makes non-box shapes (avatars, diagonal sections, arrows, stars) in plain CSS, can be animated, and cuts the click area too. It replaces plenty of extra images and SVGs.
The key idea
clip-path hides what lies outside the shape, it does not change the box
Common mistakes
Thinking clip-path changes the layout size No: the element still takes its original box, only part of it is not painted (and cannot be clicked). If the space must shrink too, change the element’s own size.
A polygon animation stutters or does not run at all A transition needs the same number of points in both shapes (and the same function). Add a "twin" point to the shape with fewer points.
Wanting a fading edge from clip-path clip-path always has a hard edge. To fade, use mask-image with a gradient or an image (graded alpha).
Try it in this playground
Drag one polygon pin Pick the polygon shape, then drag a pin (or pick one and use the arrow keys). The percentages in the code follow.
Tap the part that is cut away Still inside the 220 × 220px box, yet the browser says it hits the table: clip-path cuts the click area too.
Add a point to the polygon The new point appears halfway along a side. Drag it to change the shape, say into a house.
Press Animate from the square A three-point triangle just jumps. Add a point, stack it on the tip, then animate again.