CSS Clip Path Shapes
Create geometric shapes and masks using CSS clip-path with polygon and circle for visual design effects.
Code
.clip-triangle {
clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
}
.clip-circle {
clip-path: circle(50% at 50% 50%);
}
.clip-hexagon {
clip-path: polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
}CSS Clip Path Shapes
Create geometric shapes and masks using CSS clip-path with polygon and circle for visual design effects.
Code
.clip-triangle {
clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
}
.clip-circle {
clip-path: circle(50% at 50% 50%);
}
.clip-hexagon {
clip-path: polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
}
Explanation
polygon() and circle() cut an element into a shape and hide everything outside the path. Expected behavior: the element’s box and hit area stay rectangular, so clicks on the clipped-away corners still land on the element. Limitation: clip-path clips paint, not layout, and deeply detailed polygons are costly to animate.
Interactive Tools for This Topic
Aspect Ratio CalculatorSimplify a width-to-height ratio, show its decimal value, and derive a matching height for a new width.Border Radius PreviewPreview four-corner border-radius values on a live box and copy the generated shorthand border-radius CSS declaration.Box Shadow GeneratorBuild CSS box-shadow values with offset, blur, spread, color, opacity, and inset controls, with a live preview of the result.CSS Color Name LookupTranslate between CSS keyword color names and hex values with RGB and HSL conversions, exact name matching, and nearest-color suggestions.
Report a problem with this exampleOpens a pre-filled issue on GitHub.