~/css/clip-path-generator
CSS Clip-Path Generator
Cut elements into shapes with clip-path: choose a triangle, trapezoid, hexagon, star, arrow, chevron, speech bubble, circle, ellipse or inset rectangle, then adjust the shape with one slider. The clipped preview shows exactly what will be visible.
Using the CSS Clip-Path Generator
What clip-path does
clip-path hides every part of an element outside a shape. The element keeps its full box for layout, but only the area inside the shape is painted and clickable. It works on images, videos, gradients and whole sections.
Polygon coordinates
A polygon is a list of points, each an x and y position from the top left, usually in percent so the shape scales with the element. The generator writes the points for you; the adjustment slider moves the points that define the shape's character, such as how sharp a chevron is.
Circles, ellipses and inset
circle() and ellipse() take a radius and a centre. inset() trims each edge and accepts round for rounded corners, handy for revealing an image from the edges in an animation.
Animating shapes
You can transition between two clip-paths as long as both are polygons with the same number of points. That is how many hover reveals and morphing shapes are built.
Accessibility and clipped content
Clipping only changes what is painted. Text inside a clipped element can be cut off visually while screen readers still read all of it, and clipped-away areas stop receiving clicks. Keep important text well inside the visible shape, and test the result at several widths, since percentage points move with the element.
How do I make a slanted section edge?
Clip a full-width section with a four-point polygon whose bottom corners are at different heights, for example polygon(0 0, 100% 0, 100% 85%, 0 100%). Because the percentages follow the element's size, the slant stays in proportion on every screen width.
Worked example: a hexagon avatar
Choose the hexagon shape, apply the rule to a square image and the image is cut to six sides. Keep the image square, because a polygon defined in percentages stretches with the element, and a rectangular image would give a squashed hexagon.
Frequently asked questions
Does clip-path affect the layout?
No. The element still takes up its full rectangle; only the painting is clipped. Surrounding content does not wrap around the shape (use shape-outside for that).
Is clip-path supported?
Basic shapes and polygons work in all current browsers.
Can I add a border to a clipped shape?
Borders are clipped too. Place a slightly larger clipped element behind it in the border colour to fake an outline.
Can people still click the hidden part?
No. Clicks and hovers only register on the visible part of a clipped element, which is useful for shaped buttons but means a heavily clipped link has a smaller target.
What is the difference between clip-path and mask?
clip-path cuts a hard-edged shape. mask uses an image or gradient, so it can fade edges softly. Use clip-path for geometric shapes and mask for gradual fades.